I have a query that is almost working. What is giving me troulble is the third condition $Filter. This is based on a multi-select listbox. Basically the query should return the results where “$Food”, “$Place” and “$Filter” are met. “$Food” and “$Place” are single select listboxes, and “$Filter” is a multi-select. I can’t use the “IN” clause, that makes an “OR” statement. I need it to be an”AND” statement.
[CODE]
$Food = ($_POST[‘Food’]);
$Place = ($_POST[‘Place’]);
$Filter = ($_POST[‘Filter’]);
$string = implode(‘,’,$Filter);
// CONSTRUCT THE QUERY
$sql=”SELECT tblRestaurants.RestName, tblRestaurants.RestPage,
CONCAT(tblLocations.StreetNumber,’ ‘, tblLocations.Street) AS Address,
tblLocations.Phone, tblLocations.Price, tblLocations.Rating,
tblLocations.LocationPix, tblLocations.LocationID, tblLocDet.DetailID
FROM
tblLocations
INNER JOIN tblRestaurants ON tblRestaurants.RestID = tblLocations.RestID
INNER JOIN tblLocFood ON tblLocations.LocationID = tblLocFood.LocationID
INNER JOIN tblLocPlace ON tblLocPlace.LocationID = tblLocations.LocationID
INNER JOIN tblLocDet ON tblLocations.LocationID = tblLocDet.LocationID
INNER JOIN tblDetails ON tblLocDet.DetailID = tblDetails.DetailID
WHERE tblLocFood.FoodID = ‘$Food’
AND tblLocPlace.PlaceID = ‘$Place’
AND tblLocDet.DetailID =’$string’
GROUP BY tblLocations.LocationID
ORDER By tblRestaurants.RestName ASC
limit 100″;