PDOStatement::errorCode
PDOStatement::errorCode - Get the SQLSTATE associated with the last statement handle operation (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
Description
Syntax
string PDOStatement::errorCode ( void )
Same as PDO::errorCode(), except that PDOStatement::errorCode() only retrieves the error code from the PDOStatement object's execution operation.
Return Value
No value is returned.
Example
Get a SQLSTATE code
prepare('SELECT skull FROM bones');
$err->execute();
echo "\nPDOStatement::errorCode(): ";
print $err->errorCode();
?>
The above example will output:
PDOStatement::errorCode(): 42S02
PHP PDO Reference Manual