PHP Code:
$count=1;
$result = "SELECT * FROM profiles";
if($instrument != '') {$result .= ($count==1? " WHERE": " AND") . "instrument = $instrument ";$count++;}
if($purpose != '') {$result .= ($count==1? " WHERE": " AND") . "purpose =$purpose"; $count++;}
if($seeking != '') {$result .= ($count==1? " WHERE": " AND") . "seeking= '$seeking";$count++;}
if($age != '') {$result .= ($count==1? " WHERE": " AND") . "age = $age ";$count++;}
$numresults=mysql_query($result);
$num_results = mysql_num_rows($numresults);
I'm getting an error on the $num_results
"Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\Users\Ash\Documents\Testing site\xampp\htdocs\upload\quick-search.php on line 118"
When I put a 'or die()' with the $numresults it gives me this error. "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= strings' at line 1"
I'm not sure why, anyone help?
|