combining AND / OR statements
Posted: Sat Aug 13, 2005 7:05 pm
Hey all,
Just a quick question regarding AND / OR statement. I am using the following code in my mysql query to find matching rows to the following query.
No matter how many times I scratch my head I can't figure it out. the fields specified (industry and location) contain more than one word of text. I don't think this has anything to do with the problem since LIKE uses patter matching, but just thought I would ask.
I am pretty sure it has something to do with how I am using the 'OR' statement combined with AND. Any help is appreciated.
Cheers.
Just a quick question regarding AND / OR statement. I am using the following code in my mysql query to find matching rows to the following query.
Code: Select all
$alert = "SELECT id, email, first_name, last_name, lead_alert FROM members WHERE
(location LIKE '%".$country."%' OR location='All')
AND (industry LIKE '%".$industry."%' OR industry='All')";
$a_sql = mysql_query($alert)
or die ("Could not select matching members");I am pretty sure it has something to do with how I am using the 'OR' statement combined with AND. Any help is appreciated.
Cheers.