Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
return (mysql_result(mysql_query("SELECT COUNT (`user_id`) FROM `users` WHERE `user_id` = $user_id AND `type` = 1"), 0) == 1) ? true :false;
Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
return (mysql_result(mysql_query("SELECT COUNT (`user_id`) FROM `users` WHERE `user_id` = $user_id AND `type` = 1"), 0) == 1) ? true :false;
Try this:
<?php
$result = mysql_query("SELECT COUNT (`user_id`) FROM `users` WHERE `user_id` = $user_id AND `type` = 1");
if (!$result) {
die(mysql_error());
}
return (mysql_result($result, 0) == 1) ? true :false;
at least you will see the error.
Don't assume the query will always run ok, check for errors. Don't put everything in a single line, it makes the code too hard to read. Also: be sure to properly escape the input using mysql_real_escape_string in your case.
Also, check here