Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PDOStatement::errorCode

PDOStatement::errorCode

PHP PDO Reference ManualPHP PDO Reference Manual

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 ManualPHP PDO Reference Manual