Hello Everyone, I was trying to figure out why this particular mysql_query() doesn't return false and how to deal with it. First of all, I have a table (call it table1) with only one row in it. The one row has a 2 in the user_id column. So when I do
$theQuery="SELECT * FROM table1 WHERE 'user_id'='$numVar'";
if(!mysql_query($theQuery)){echo "SOMETHING!";echo "SOMETHING ELSE";}
the echo's dont work when $numVar does not match the only row in there with a 2 for user_id. I thought that when a query does not match anything it returns FALSE but instead it returns "resource" as per gettype() and "mysql result" from get_resource_type. When I print_r(mysql_fetch_array(mysql_query($theQuery),MYSQL_NUM)) it prints a 1. I thought that would print a 0 if anything for the first row but I don't understand what is going on here. Any insight as to what is happening or how to deal with it. I need to check the table to make sure that there is no row with user_id=$numVar in a boolean. I thought the code would work thinking that if there were no matching value in the specified column the mysql_query() would return FALSE. Any help is very much appreciated. I don't know what is even going on anymore.