Searching Sqlite database data with php

Asked

Viewed 22 times

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 the session_start();? Third, can you pull the data "manually" from the database? The connection is correct and working?

  • 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

  • But you can print your own $_SESSION["Aluno"] ?

  • Yes, with you, I just tested.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.