0
I’m Learning reactphp
and when I try to pay back the data bank information of that mistake Undefined index
I don’t know why
code q am using:
<?php
require 'vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$server = stream_socket_server('tcp://127.0.0.1:8080');
stream_set_blocking($server, false);
$loop->addTimer(0.8, function () {
include 'conect.php';
$sql = "SELECT `Msn` FROM `tss`";
$execut=mysqli_query($link,$sql);
while($row = mysqli_fetch_row($execut)){
$msn = $row['Msn'];
echo $msn . PHP_EOL;
echo "<br>";
}
});
$loop->addTimer(0.3, function () {
include 'conect.php';
$sql1 = "SELECT `Usuario` FROM `tss`";
$exe =mysqli_query($link,$sql1);
while($row = mysqli_fetch_row($exe)){
$usu=$row['Usuario'];
echo $usu;
}
});
$loop->run();
?>
connection to the seat:
<?php
$host ="localhost";
$usu="root";
$senha="";
$bd="ts";
$link = mysqli_connect($host, $usu, $senha, $bd);
if (!$link) {
echo "Error: Falha ao conectar-se com o banco de dados MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
?>
Have you checked the value of
$row
? What is?– Woss
@Andersoncarloswoss,
$row['Msn']
that comes from the column Msn, she has the die that was to bring that wouldTESTE
– Cyber Hacker
Emphasis on "was to bring". The question is, did you check if the value came?
– Woss
@Andersoncarloswoss giving a
var_export($row)
he comes backarray ( 0 => 'TESTE',)
I could be wrong but he was supposed to come back0=>'Teste'
and yesMsn=>'Teste
would you explain to me why he’s coming back 0– Cyber Hacker