PDOStatement :: errorCode
PDOStatement :: errorCode - a statement handle to keep access to relevant operations SQLSTATE (PHP 5> = 5.1.0, PECL pdo> = 0.1.0)
Explanation
grammar
string PDOStatement::errorCode ( void )
With PDO :: errorCode (), except that PDOStatement :: errorCode () only retrieves PDOStatement object to perform the operation error code.
return value
No return value.
Examples
Retrieve a SQLSTATE code
<?php /* 引发一个错误 -- BONES 数据表不存在 */ $err = $dbh->prepare('SELECT skull FROM bones'); $err->execute(); echo "\nPDOStatement::errorCode(): "; print $err->errorCode(); ?>
The above example will output:
PDOStatement::errorCode(): 42S02