0
I’m trying to get the name of my Session, and search the database for the data of those who have this name, but echo returns absolutely nothing.
$nome = $_SESSION["Aluno"];
$results = $db->query('Select * from alunos where nome = $nome ');
while($row = $results->fetchArray()){
$row = (object) $row;
echo $row->nome." / ";
echo $row->disciplina." / ";
echo $row->faltas." / ";
echo $row->nota." <br> ";
echo "----------"."<br>";
}
What am I doing wrong?
First, you can print the variable
$nome
? If you can’t, change$_SESSION["Aluno"];
for$_SESSION['Aluno'];
(Single quotes). Second, you started thesession_start();
? Third, can you pull the data "manually" from the database? The connection is correct and working?– Felipe Guimarães
Yes, I can print $name, and if I change $name for "test", which would be my Ssion, in the select part, the routine works normally and the data is printed on the page. The database is working and Siession too, I just can’t puck the data passing the variable in select
– Felipe Marabolí
But you can print your own
$_SESSION["Aluno"]
?– Felipe Guimarães
Yes, with you, I just tested.
– Felipe Marabolí