title: Mysql query with multiple ands and ors
body: <p>I'm trying to make a filter function for servers on my site. Users are able to check different options for the categories they want to filter for, and I have an ajax request that returns the servers satisfying their conditions. However, my mysql_query isn't working, I think I might have the wrong syntax.</p>
  
  <p>By default, each category has the option set as 1. My current query is:</p>
  
  <pre><code>$order = "SELECT * FROM `servers` 
      WHERE `size` = '$size' or 
        1 = '$size' and 
        `type` = '$type' or 
        1 = '$type' and 
        `mode` = '$gamemode' or 
        1 = '$gamemode' and 
        `main` = '$main' or 
        1 = '$main' 
      ORDER BY $orderby 
      LIMIT 5";
  </code></pre>
  
  <p>It doesn't seem to get the correct servers, do I have an error in my query?</p>
  
  <p>Thanks!</p>