You can use OR, like select … from … where xyz=‘something’ OR abc=‘something else’;
Another way is to make a custom query depending on the input.
Like,
$query = 'SELECT * FROM TBL WHERE ';
if ( $age )
{
$query .= "AGE='$age'";
}
//and same with other 2, just make sure you don't end up having a query like: "SELECT * FROM TBL WHERE"
//because WHERE will expect something, so you'll get errors.
Another easy way is just to use a little case statement trick and just pass through both the variables each time - for instance, assuming that ‘zero’ means the var should be ignored
SELECT * FROM
Table
WHERE
SomeField = CASE @SomeVar WHEN 0 THEN SomeField ELSE @SomeVar END
AND
SomeOtherField = CASE @SomeOtherVar WHEN 0 THEN SomeOtherField ELSE @SomeOtherVar END
This simply checks the value of the variable - when it’s 0 then it compares each data field against itself instead of the variable (effectively ignoring the filter as a field always equals itself)