0
I’m having the error below when listing a user’s data by function lista()
.
Parse error: syntax error, Unexpected 'name' (T_STRING) in /home/adelanmu/public_html/usuario-class.php on line 54
public function lista(){
$pdo = Conexao::conexao();
$sql = 'SELECT * FROM usuario WHERE id_cliente = ' .
$_SESSION['id_cliente'];';
$consulta = $pdo->query($sql);
$dados = null;
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)){
$dados[] = array(
"nome" => $linha['nome'],
"email" => $linha['email'],
"senha" => $linha['senha']
);
}
$pdo = null;
return $dados;
}
$sql = "SELECT * FROM usuario WHERE id_cliente = '".$_SESSION['id_cliente']."'" ;
try like this– Pedro Augusto
Hello Walter all right? Can you post a dump of the line array? Put a var_dump($line) and put here please.
– Patrick Maciel
brother gora aparece esse erro Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id_cliente' in 'where clause'' in /home/adelanmu/public_html/usuario-class.php:55 Stack trace: #0 /home/adelanmu/public_html/usuario-class.php(55): PDO->query('SELECT * FROM u...') #1 /home/adelanmu/public_html/perfil.php(5): Usuario->lista() #2 {main} thrown in /home/adelanmu/public_html/usuario-class.php on line 55
– Walter Alves Ambrosio