Forum Moderators: coopster
then submit
$where = join($subjectChecked, ' = "y" OR ') . ' = "y"';
//Create Query
$query = "SELECT * FROM part WHERE $where AND WARDS = 'y' AND pet = 'y'";
$result = mysql_query($query) or die (mysql_error());
$num = mysql_numrows($result);
?>
Thanks again
In this case you should start by echoing $query to see what statement is being used as the query.
By the looks of it your forming an array $subjectChecked from checkbox selections and then imploding it to a string with ' = "y" OR ' as the glue.
SELECT * FROM part WHERE foo = "y" OR boo = "y" AND WARDS = 'y' AND pet = 'y'
Try changing all quotes within statement to singles ie.
$where = join($subjectChecked, " = 'y' OR ") . " = 'y'";
Also i'm a bit doubtful over the syntax with those 'ands' and 'ors'. Try running the statement through cmd line or phpmyadmin.