Forum Moderators: coopster
...
$sql = "SELECT field1, field2, ... fieldN FROM tablename";
$counter=0;
if (test to decide you want to output a price restriction) {
$sql .= "WHERE `price`= $price";
$counter++;
}
if (test to decide you want to output a location restriction) {
if ($counter ==0) {
$sql .= "WHERE ";
} else {
$sql .= "AND ";
}
$sql .= "`location`= $location";
$counter++;
}
...