title: How to view query error in PDO PHP
body: <pre><code>try {
      $db = new PDO("mysql:host=".HOST.";dbname=".DB, USER, PW);
      $st = $db-&gt;prepare("SELECT * FROM c6ode");
  }
  catch (PDOException $e){
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>How can I check the mysql error for the query in above case? </p>