note 101758 modified in pdo.errorinfo by danbrown
| From: | danbrown@php.net | Date: | Sun, 09 Jan 2011 21:29:57 +0000 |
| Subject: | note 101758 modified in pdo.errorinfo by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175587@lists.php.net to get a copy of this message | ||
Please note : that this example won't work if PDO::ATTR_EMULATE_PREPARES is true.
You should set it to false
<?php
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES,false);
$stmt = $dbh->prepare('bogus sql');
if (!$stmt) {
echo "\nPDO::errorInfo():\n";
print_r($dbh->errorInfo());
}
?>
--was--
Please note : that this example won't work if PDO::ATTR_EMULATE_PREPARES is true.
You should set it to false
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES,false);
$stmt = $dbh->prepare('bogus sql');
if (!$stmt) {
echo "\nPDO::errorInfo():\n";
print_r($dbh->errorInfo());
}
http://php.net/manual/en/pdo.errorinfo.php