Hi everyone, I'm not able to do a select in my PHP database. I already tried to implement several solutions, however it always returns 0 results, and I have data in my DB.
I am using external files to connect to the bank and they are working.
And the contents of the spans always remain empty.
<?php $idUser = $_SESSION["user_id"];
if (mysqli_num_rows($result) > 0) {
$result = mysqli_query("SELECT idMessage, name, telefone, mensagem FROM Messages where Messages.idUser = '$idUser' ");
while($row = mysql_fetch_array($result)) :
$id = $row["idMessage"];
$name = $row["name"];
$mensagem = $row["mensagem"];
endwhile;
} else {
echo "0 results";
}
?>
<span><?php echo $id ?></span>
<span><?php echo $name ?></span>
<span><?php echo $mensagem ?></span>