mysql_query () either returns a handle to the instruction (the query is being executed) or a boolean value of FALSE (the query is not completed). Your code does not check for errors and blindly accepts success. Change the code to look like this:
$result=mysql_query($numUsersSameRatingQuery) or trigger_error(mysql_error()); ^^^^^^^^^^^^^^^^^^^^^^--- add this
Given your sample query, you are missing the FROM keyword and probably should be:
SELECT * FROM `user ratings` ^^^^^^
I would STRONGLY urge NOT to use field names containing spaces. This is nothing but trouble.
source share