I need to create a complete sql statement, based on many search criteria.
So it would be
$sql="select * from products where onsale=1 ".$sql1.$sql2.$sql3;
for example, based on the situations these $sql1.$sql2.$sql3 would be assigned different values. such as
$sql1=" AND city_id=1 ";
$sql2=" AND store_id=34 "
...
Also there could be cases that in certain situation I will ask the sql return nothing
For example, in certain case, I want the $sql1 or $sql2 situation cause the whole statement return no results, I will assign the value like this
$sql1= " AND FALSE ";
or
$sql2= " AND FALSE ";
...
So $sql="select * from products ".$sql1.$sql2.$sql3; will return no results.
Thanks!