This seemed like a good idea to me but it's not working out the way that I want ... I'm probably over-complicating it 8-) I'm trying to allow users to search for other users in their area and part of the search criteria gives you 8 different options to choose from. They can choose 1 or all 8 if they want to. Here is how I set it up.
$looking_for = " ".$_GET['lf1']." ".$_GET['lf2']." ".$_GET['lf3']." ".$_GET['lf4']." ".$_GET['lf5']." ".$_GET['lf6']." ".$_GET['lf7']." ".$_GET['lf8']."";
if($looking_for =='Any'){
$pag="SELECT * FROM users WHERE zip IN ({$zcodes}) AND gender='$gender' AND age BETWEEN '$min_age' and '$max_age'";} else{
$pag="SELECT u.*, up.* FROM users AS u INNER JOIN user_profile AS up ON u.id = up.user_id WHERE u.zip IN ({$zcodes}) AND u.gender='$gender' AND u.age BETWEEN '$min_age' and '$max_age' AND up.lf1 OR up.lf2 OR up.lf3 OR up.lf4 OR up.lf5 OR up.lf6 OR up.lf7 IN ({$looking_for}) ;}
When I echo $looking_for and even though it's value is 'Any' it still skips my if statement and gives me an unknown column in my where clause which would be ({$looking_for})
It seemed like it should work. Am I trying to make it do something that is just never gonna happen?