PDOStatement::errorCode — Get the SQLSTATE related to the last statement handle operation (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
string PDOStatement::errorCode ( void )
Same as PDO::errorCode(), except that PDOStatement::errorCode() only retrieves the error code in the operation performed by the PDOStatement object.
There is no return value.
<?php/* Raises an error -- BONES data table does not exist*/$err = $dbh->prepare('SELECT FROM skull bones');$err->execute();echo "nPDOStatement::errorCode( ): ";print $err->errorCode();?>
The above routine will output:
PDOStatement::errorCode(): 42S02