<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 19 Jun 2013 09:03:44 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Handling SQL Errors in PDO]]></title>
      <guid>http://www.phpdeveloper.org/news/17134</guid>
      <link>http://www.phpdeveloper.org/news/17134</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has a quick new post showing one way to <a href="http://www.lornajane.net/posts/2011/handling-sql-errors-in-pdo">handle SQL errors in PDO</a> that could pop up because of badly written/generated SQL statements.
</p>
<blockquote>
I love <a href="http://php.net/pdo">PHP's PDO (PHP Data Objects)</a> extension; it gives a consistent, object-oriented interface to handling all kinds of relational database backends. One thing that annoys me is that the MySQL driver for PDO defaults to a silent error mode which can make SQL errors tricky to spot!
</blockquote>
<p>
In her two code snippets she shows a failing PDO request (that fails silently) and a method for catching this issue - checking the result of the "<a href="http://us2.php.net/manual/en/pdo.errorcode.php">errorCode</a>" method to see if it equals "0" (zero). If there were errors, you can use the "<a href="http://us2.php.net/manual/en/pdo.errorinfo.php">errorInfo</a>" function to get to them. This will return the SQL error code, the driver-specific error code and a driver-specific error message.
</p>]]></description>
      <pubDate>Wed, 16 Nov 2011 09:43:34 -0600</pubDate>
    </item>
  </channel>
</rss>
