title: PHP PDO prepare statement for update
body: <p>The following is my attempt at a prepare statement. It is causing the page to die at the moment so obviously something is wrong.</p>
  
  <pre><code>function telephoneinsert($elector,$inputs,$outputs){
              global $dbh;
              $sql = "UPDATE electors SET $inputs WHERE ID=?";
              $q = $dbh-&gt;prepare($sql);
              $q-&gt;execute(array($outputs,$elector));
              //UPDATE STATS
          }
  </code></pre>
  
  <p>That is the function called on page like this</p>
  
  <pre><code>telephoneinsert($Ielector,$inputs,$outputs);
  </code></pre>
  
  <p>Where $inputs = a posted array that if echoed looks like this <code>name = ?, type =?</code>. It is deliberately rtrim'd to get rid of the last comma.</p>
  
  <p>Same principle with $outputs if echoed looks like <code>benjamin,socialist</code></p>
  
  <p>ERROR REPORTING SHOWING NOTHING</p>
  
  <pre><code>$this-&gt;pdo-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
          print_r($dbh-&gt;errorInfo());
  </code></pre>