So, this is my code:
$query = "SELECT `id` FROM `users` WHERE `username`='$username' AND `password`='$password_hash'";
echo $query;
echo mysql_result(mysql_query($query), 0);
When I run this code in PHP, I take the query executed, and run it in phpMyAdmin, it shows the id 1. But it does not output anything, when the complete code is run, instead I get this error:
Warning: mysql_result() expects parameter 1 to be resource
From the php manual :
mysql_query() will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.Are you sure you are connected to the database and have to good rights ?