php - mysql_num_rows() issue :: same result of two queries -


$query = "select contents contents name = '$view'"; $select = mysql_query($query);  if(mysql_num_rows($select) == 0){     //do something// } else{     //do something// } 

the code working without problem, if change query following

$query = "select contents contents name = '$view' , website = '$website_mode'"; 

i got warning empty result set,

warning: mysql_num_rows() expects parameter 1 resource, boolean given in

note: used printf print both queries , tried them thru phpmyadmin , both giving me same result set.

when $select = mysql_query($query); has erroneous result, returns boolean false.

meaning $select = false, , can't execute mysql_num_rows() on boolean.

you can print $sql see if end result sql ok.

and can mysql_error() see actual mysql error given, example missing tables, connecting wrong database, etc..


Comments