Rectangle 27 0

php Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given?


$amn = mysql_query("SELECT * FROM `Messages` WHERE to_user='$usr' AND read='0'");

if($amn === false) {
    var_dump(mysql_error());
}
else {
    print_r(mysql_num_rows($amn));
}

Code above is written in bad style and deprecated. Use PDO with Exceptions in real projects.

Note
Rectangle 27 0

php Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given?


plz check http://php.net/manual/de/function.mysql-query.php, mysql_query returns false (a boolean) if something went wrong. This would match your error message (a boolean is given instead of a resource). You can check the last error with "mysql_error()".

Note