title: pdo catch and output mysql errors
body: <p>I have an insert statement that is executed with PDO. Insert works great however if there is an error I would like it displayed to the user.</p>
  <p>I have the below try-catch block.</p>
  <pre><code>try{ 
      $insertuser = $db-&gt;prepare('INSERT INTO `she_she`.`Persons` (`idnumber`,`addedby`,`firstname`, `middlename`, `surname`, `fullname`, `gender`, `birthdate`, `homelanguage`, `department`, `employeetype`, `employeestatus`) VALUES  (?,?,?,?,?,?,?,?,?,?,?,?)'); 
      $insertuser-&gt;execute(array($idnumber,$user,$firstname, $middlename, $surname, $fullname, $gender, $birthdate, $language, $department, $employmenttype, $personstatus));  
  } 
  catch(PDOException $exception){ 
      return $exception; 
  } 
  </code></pre>
  <p>If the query fails, or let's say a duplicate IDNumber, I want this displayed to the user.</p>
  <p>If I simply try to echo the variable $exception it does not work.</p>
  <p>I want to return the MySQL error to the user.</p>