title: lastInsertId() not working on a PDO object, in an insert operation
body: <p>I initialize the class with these options:</p>
  
  <pre><code>$options = array(
        PDO::ATTR_PERSISTENT =&gt; true, 
        PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION
  );
  </code></pre>
  
  <p>Then i behave like this</p>
  
  <pre><code>$this-&gt;sql = trim($sql);
  $this-&gt;bind = $this-&gt;cleanup($bind);
  $this-&gt;error = "";
  
  try {
     $pdostmt = $this-&gt;prepare($this-&gt;sql);
     if($pdostmt-&gt;execute($this-&gt;bind) !== false) {
         if(preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this-&gt;sql))
             return $pdostmt-&gt;fetchAll(PDO::FETCH_ASSOC);
         elseif(preg_match("/^(" . implode("|", array("delete", "update")) . ") /i", $this-&gt;sql))
             return $pdostmt-&gt;rowCount();
         elseif(preg_match("/^(" . implode("|", array("insert")) . ") /i", $this-&gt;sql))
             return $pdostmt-&gt;lastInsertId();
  }
  </code></pre>
  
  <p>that's because after an INSERT i need to return the last inserted id.
  but i've been told lastInsertId() is not a function.
  so it doesn't work.</p>
  
  <p>any idea? maybe wrong options? 
  thank you</p>