From b6e207d730cde1fde06db1350127aa9d57f7d009 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Wed, 14 Feb 2007 19:42:28 +0000 Subject: [PATCH] fix example (noticed by a user note) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@229814 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pdo/functions/PDO-errorInfo.xml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/reference/pdo/functions/PDO-errorInfo.xml b/reference/pdo/functions/PDO-errorInfo.xml index 7324c61973..afbb0f025f 100644 --- a/reference/pdo/functions/PDO-errorInfo.xml +++ b/reference/pdo/functions/PDO-errorInfo.xml @@ -1,5 +1,5 @@ - + PDO->errorInfo() @@ -71,11 +71,12 @@ prepare('SELECT skull FROM bones'); -$err->execute(); -echo "\nPDO::errorInfo():\n"; -print_r($err->errorInfo()); +/* Provoke an error -- bogus SQL syntax */ +$stmt = $dbh->prepare('bogus sql'); +if (!$stmt) { + echo "\nPDO::errorInfo():\n"; + print_r($dbh->errorInfo()); +} ?> ]]> @@ -85,9 +86,9 @@ print_r($err->errorInfo()); PDO::errorInfo(): Array ( - [0] => 42S02 - [1] => -204 - [2] => [IBM][CLI Driver][DB2/LINUX] SQL0204N "DANIELS.BONES" is an undefined name. SQLSTATE=42704 + [0] => HY000 + [1] => 1 + [2] => near "bogus": syntax error ) ]]>