PHP PDOStatement:: errorInfo Explanation
- 2021-11-14 05:11:29
- OfStack
PDOStatement::errorInfo
PDOStatement:: errorInfo--Gets the extended error message associated with the last statement handle operation (PHP 5 > = 5.1.0, PECL pdo > = 0.1.0)
Description
Grammar
array PDOStatement::errorInfo ( void )
PDOStatement::errorInfo()
Returns an array of error messages about the last operation performed by the statement handle. The array contains the following fields:
Element information
0 SQLSTATE error code (a 5-letter or numeric identifier defined in the ANSI SQL standard).
1 specific drive error code.
2 specific drive error message.
Instances
Displays the fields of errorInfo () for the PDO_ODBC connection connected to the DB2 database
<?php
/* Excite 1 Errors -- BONES Data table does not exist */
$sth = $dbh->prepare('SELECT skull FROM bones');
$sth->execute();
echo "\nPDOStatement::errorInfo():\n";
$arr = $sth->errorInfo();
print_r($arr);
?>
<pre>
PDOStatement::errorCode(): 42S02
The above routine outputs:
PDOStatement::errorInfo():
Array
(
[0] => 42S02
[1] => -204
[2] => [IBM][CLI Driver][DB2/LINUX] SQL0204N "DANIELS.BONES" is an undefined name. SQLSTATE=42704
)
Summarize