I have a searchform where you can search for properties. Right now it only works if you fill in all the fields. But how would I do if I want to eg leave a field blank and just search the rest, or just search one field and leave the rest blank?
This is the code for the query I have today:
$sql = mysql_query("
WHERE (rooms LIKE '%$room%' OR '$room' = '')
AND (status LIKE '%$status%' OR '$status' = '')
AND (type LIKE '%$type%' OR '$type' = '')
AND (adress LIKE '%$county%' OR '$county' = '')
AND (area LIKE '%$area%' OR '$area' = '')
AND (price BETWEEN '$min' AND '$max')
") or die(mysql_error());
Thanks in advance!
Maybe you should note that all the fields are select fields, not text fields.