Hello, the most helpful forum in the world 😉
I'm trying to display filtered results from database
$var1 = "US";
$var2 = "not selected from dropdown"; // when I choose to only filter based on other
$var3 = "female";
$result = mysql_query("SELECT * FROM offers WHERE country_id='$var1' AND name='$var2' AND gender='$var3' ORDER BY ".$sortby." ".$ascdesc."") or die(mysql_error());
$var variables are selected from dropdown elsewhere, I just entered here as an example.
So the problem is if one of the variables is not selected(empty) query doesn't return the results, is there any way I can tell query to ignore an empty $var2 and filter based on other selected(defined variables) ones???
I tried setting $var='*' but it didn't work, is there any symbol that defines "any" or "all" or somthing like that
thanks in advance