downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<PDOStatement->columnCountPDOStatement->errorInfo>
Last updated: Thu, 26 Jun 2008

PDOStatement->errorCode

(PHP 5 >= 5.1.0, PECL pdo:0.1-1.0.3)

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

Description

string PDOStatement::errorCode ( void )

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



add a noteadd a note User Contributed Notes
Fetch the SQLSTATE associated with the last operation on the statement handle
There are no user contributed notes for this page.




<PDOStatement->columnCountPDOStatement->errorInfo>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs