diff --git a/reference/pdo/functions/PDOStatement-errorInfo.xml b/reference/pdo/functions/PDOStatement-errorInfo.xml index e67c751dd6..9ff93b1eb7 100644 --- a/reference/pdo/functions/PDOStatement-errorInfo.xml +++ b/reference/pdo/functions/PDOStatement-errorInfo.xml @@ -1,11 +1,11 @@ - + PDOStatement::errorInfo - Fetch extended error information associated with the last operation on the statement handle + Fetch an array of error information associated with the last operation on the statement handle @@ -15,7 +15,66 @@ - &warn.undocumented.func; + &warn.experimental.func; + + PDOStatement::errorInfo returns an array of + error information about the last operation performed by this + statement handle. The array consists of the following fields: + + + + + Element + Information + + + + + 0 + Generic PDO error code corresponding to one of the + PDO_ERR_* constants. + + + 1 + Driver-specific error code. + + + 2 + Driver-specific error message. + + + + + + + Displaying errorInfo() fields for a PDO_ODBC connection to a DB2 database + +prepare('SELECT skull FROM bones'); +$sth->execute(); + +$arr = $sth->errorInfo(); +if ($arr[0] == PDO_ERR_NOT_FOUND) { + echo "Error: a requested database object does not exist.\n"; + printf("Driver-specific error code: %d\n", $arr[1]); + printf("Driver-specific message: [%s]\n", $arr[2]); +} +?> +]]> + + + &example.outputs; + + +