PDOStatement::errorCode

(no version information, might be only in CVS)

PDOStatement::errorCode --  Fetch the SQLSTATE associated with the last operation on the statement handle

Description

int PDOStatement::errorCode ( void )

Warning

This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.

Return Values

Identical to PDO::errorCode(), except that PDOStatement::errorCode() only retrieves error codes for operations performed with PDOStatement objects.

Examples

Example 1. Retrieving a SQLSTATE code

<?php
/* Provoke an error -- the BONES table does not exist */
$err = $dbh->prepare('SELECT skull FROM bones');
$err->execute();

echo
"\nPDOStatement::errorCode(): ";
print
$err->errorCode();
?>

The above example will output:

PDOStatement::errorCode(): 42S02

See Also

PDO::errorCode()
PDO::errorInfo()
PDOStatement::errorInfo()

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 18:00:24