title: When to use OR , AND in MYSQL for advanced search query result
body: <p>I am trying to build an advance search option for our website. I am having trouble getting this to work? Basically the only thing that needs to be constant is the '<strong>review_live = 1</strong>' , the rest is only if the user searches for it. Why isn't this working correctly, maybe I am not using OR, AND correctly in longer queries...</p>
  
  <pre><code>    WHERE 
      review_live = 1 AND
      city LIKE '%$location%' OR 
      region LIKE '%$region%' OR 
      date BETWEEN '$beginDate' AND '$endDate' OR
      name LIKE '%$name2%' OR
      type LIKE '%$type1%' OR 
      type_2 LIKE '%$type2%' 
      ORDER BY date DESC
  </code></pre>