I made a simple login screen in the local environment (xampp) and it works perfectly, without any error, however, when uploading to my web server (both run PHP 7.1), it does not work, it only generates the error message login and password. After checking the possible errors, I have identified that the SQL query is not working inside PHP (it always returns 0), however, in PHPmyAdmin the web server works normally, I am using a view to return user data. The entire bank on the web server is identical to the location.
Follow the code below:
if($sql = $mysqli->prepare("SELECT * FROM 'vw_login' WHERE 'login' = ? LIMIT 1")) {
$sql->bind_param("s", $frmlogin);
$sql->execute();
$sql->bind_result($id, $nome, $hash);
if($sql->fetch() AND Bcrypt::check($frmsenha, $hash)) {
...
header('Location: /');
} else {
session_destroy();
$retorno = "Login ou senha incorretos.";
}
$sql->close();
}