title: Getting mysql to ignore where condition
body: <p>Is there to make mysql ignore conditions if a variable isn't set, e.g.</p>
  
  <pre><code>SELECT *
  FROM foo
  WHERE id = $id
  AND bar = $baz
  </code></pre>
  
  <p>If $baz is set run query as normal, else run the query minus the AND clause?</p>
  
  <p>Thanks</p>