title: PDO Transaction doesn catch exceptions
body: <p>I am trying PDO  transactions for the first time. The below code doesnt work. the email address we are trying to insert has a duplicate so it should fail. It does give me an error. but the first insert get inserted into the DB and it doesnt roll back. I know rollback work cuase if i move PDO::rollBack into the Try{ before commit, it does roll back. I think the problem is its not catching the error, therefore not calling PDO::rollBack. Any ideas?</p>
  
  <pre><code>try {
      PDO::beginTransaction();
  
  $sql = "INSERT INTO .`tblUsersIDvsAgencyID` (`id`, `agency_id`) VALUES (NULL, :agencyID)";
  $STH = $this-&gt;prepare($sql); 
  $STH-&gt;bindParam(':agencyID', $AgencyUser['agency_id']);
  $STH-&gt;execute();
  $userID = parent::lastInsertId();
  
  $sql = "INSERT INTO `tblUsersEmailAddress` (`id`, `user_id`, `email_address`, `primary`, `created_ts`, `email_verified`) VALUES (NULL ,  :userID ,  :EmailAddress ,  '1', CURRENT_TIMESTAMP ,  '0' )";
  $STH = $this-&gt;prepare($sql); 
  $STH-&gt;bindParam(':userID', $userID);
  $STH-&gt;bindParam(':EmailAddress', $email_address);
  $STH-&gt;execute();
  PDO::commit();
  echo 'Data entered successfully&lt;br /&gt;';
  }
  catch(PDOException $e)
  {
  /*** roll back the transaction if we fail ***/
  PDO::rollBack();
  echo "failed";
  } 
  </code></pre>