I have the following problem: I want to let a user apply filters to a DB search. I have three filters, A, B and C. All of them can be \"empty\", as in, the user doesn\'t care a
Before your query you could use:
$tmp = "where "; if($A and $A!="any" and $A!="not used") $tmp .= "row1 = '".$A."'"; if($B and $B!="any" and $B!="not used") $tmp .= "AND row2 = '".$B. "'"; if($C and $C!="any" and $C!="not used") $tmp .= "AND row3 = '".$C."'"; $db_q = "Select * from table $tmp";