PDOSTATEMENT.ERRORCODE(3) 1 PDOSTATEMENT.ERRORCODE(3)
PDOStatement::errorCode - Fetch the SQLSTATE associated with the last operation on the statement handle
SYNOPSIS
public string PDOStatement::errorCode (void )
DESCRIPTION
RETURN VALUES
Identical to PDO.errorCode(3), except that PDOStatement.errorCode(3) only retrieves error codes for operations performed with PDOStatement
objects.
EXAMPLES
Example #1
Retrieving an SQLSTATE code
<?php
/* Provoke an error -- the BONES table does not exist */
$err = $dbh->prepare('SELECT skull FROM bones');
$err->execute();
echo "
PDOStatement::errorCode(): ";
print $err->errorCode();
?>
The above example will output:
PDOStatement::errorCode(): 42S02
SEE ALSO
PDO.errorCode(3), PDO.errorInfo(3), PDOStatement.errorInfo(3).
PHP Documentation Group PDOSTATEMENT.ERRORCODE(3)