First of all, please make sure you have proper verbose error to identify root cause:
if ($stmt = $conn->prepare("SELECT id, password FROM accounts WHERE email = ?")) {
$stmt->bind_param("s", $_POST['username']);
$stmt->execute();
$stmt->store_result();
....
else{
$error = $conn->errno . ' ' . $conn->error;
echo $error;
}
Once this in place, I can get the exact error message in browser:
1142 SELECT command denied to user 'xxxx'@'localhost' for table 'accounts'DB error
So my xxxx user does not have proper access.
This is easily to be fixed by running the following command:
GRANT SELECT ON db.accounts TO xxxx@'localhost';
No comments:
Post a Comment