title: Filtering PDO SQL Queries
body: <p>I'm using PDO method in my PHP page to implode two strings (in order to create a graph... long story!), but I don't know how to filter them. The table structure in MySQL is like this:</p>
  
  <p>Column Name:
  <strong>item</strong> (the name of the item being voted on);
  <strong>nvote</strong> (the number of votes this item has received);
  <strong>date</strong> (the dates of the votes)</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>$stmt1 = $db-&gt;prepare("SELECT date FROM vote"); 
  $stmt1-&gt;execute();
  
  $stmt2 = $db-&gt;prepare("SELECT nvote FROM vote"); 
  $stmt2-&gt;execute();
  
  $line1 = implode( ',', $stmt1-&gt;fetchAll (PDO::FETCH_COLUMN) ); 
  $line2 = implode( ',', $stmt2-&gt;fetchAll (PDO::FETCH_COLUMN) );
  </code></pre>
  
  <p>(Line1 creates the x-axis of my graph, line2 creates the y-axis)</p>
  
  <p>This works very well to generate the strings for my graph.</p>
  
  <p>How can I filter these so that name of the item being voted on (in the "<strong>item</strong>" column") is filtered by a var (in this case, <code>$nameofitem</code>)? I can't seem to get it to work.</p>