I do not know why this error occurred.
PDA :: fetch () in /opt/lampp/htdocs/myschool.com.br/login.php:24 Stack trace: # 0 {main} thrown in / opt /lampp/htdocs/myschool.com.br/login.php on line 24
PHP
use dao\Connection;
session_start();
//Incluir a conexão com banco de dados
include 'application/dao/Connection.php';
date_default_timezone_set("Etc/GMT+3");
if(!empty($_POST)){
$res='';
$email = $_POST['email'];
$senha = $_POST['password'];
$sql = "SELECT idlog, logname
FROM login
WHERE logemail='$email' AND logpassword=md5('$senha')
AND logBlocked = 'no' AND logstatus = 1;";
$res = Connection::getInstance();
$res->prepare($sql);
$res->exec($sql);
$dados = $res->fetch();
if(empty($dados)){
echo "<script>alert('Seu login falhou. LOGIN: [email protected] SENHA: 123');</script>";
} else {
$_SESSION['login'] = true;
$_SESSION['id'] = $dados['id'];
$_SESSION['name'] = $dados['name'];
header("location: index.php");
}
}