Jump to content

Using Multiple Or In Mysql_query


ProblemHelpPlease
 Share

Recommended Posts

I'm trying to find the correct way of using several OR and AND in a mysql_queryCode is below,

$result = mysql_query("SELECT * FROM blah WHERE (blaha = '$blaha' OR blaha = '$blaha1' OR blaha = '$blaha2') AND otherblah = '$otherblah' AND moreblah = 'Yes' AND extralblah = 'Yes'");

I want to select all records where blaha can be 3 different valuesI know i could use multiple queries and then combine the result but I thought I could use bracketsAdvice appreciated

Link to comment
Share on other sites

Syntactically it's correct, if the query matches the logic you're going for I can't really say. Have you tried to test the query? You don't need to run this through PHP, you can just type queries into phpMyAdmin to run them.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...