I'm doing a task scheduling system.
I need to show these tasks to the user, I created a file called tarefas.php
to query the MySQL database:
<?php
include_once 'conexao-calendario.php';
include_once 'VerificarLogin.php';
$usuario = $_SESSION['email'];
$sql = "SELECT id, titulo, local, data, horario, status FROM eventos WHERE email = '$usuario' ORDER BY data, hora ";
$select = $pdo->prepare($sql);
$result = $pdo->query($sql);
$dados = $result->fetchAll( PDO::FETCH_ASSOC );
var_dump($dados);
?>
Without the order by
the correct array appears, but with it it gives the following error:
Fatal error: Uncaught Error: Call to a member function fetchAll () on boolean in C: \ xampp \ htdocs \ hope \ tasks.php: 9 Stack trace: # 0 {main} thrown in C: \ xampp \ htdocs \ hope \ tasks.php on line 9