title: PDO Query with variable number of queries
body: <p>I'm making a simple php page that is going to display information from a database, filtered by certain criteria. I would like to know if it's possible to have a PDO SQL query with a variable number of SQL 'where's.</p>
  
  <p>If I was using mysql I would just do something like:</p>
  
  <pre><code>$condition1 = "WHERE male = 1 ";
  $condition2 = "AND ethnicity = 1 ";
  $condition3 = "";
  $queryParam =  $condition1 . $condition2 . $condition3; 
  
  $sql = "SELECT COUNT(*) from users '$queryParam'
  </code></pre>
  
  <p>Adding a new line for each condition</p>
  
  <p>The query code doesn't need to be input from the code, I'm just trying to make the code easier to port for different projects.</p>