ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:errorno

errorNo

See Also

errorMsg()

Syntax
string ADOConnection::errorNo()

Description

The method errorNo returns an unfriendly error code about the last known error. Note that depending on the DBMS, the message may also contain string identifiers.

If there is currently no error, the function returns an empty string


Usage

/*
 * Oracle database connection assumed
 */
 
/*
 * An invalid SQL statement that violates a constraint
 */
$SQL = 'INSERT INTO test (ID) VALUES (0)';
 
/*
 * Execute the statement, suppressing any errors
 */
$desc = @$db->execute($SQL);
 
/*
 * Get the last error code
 */
$e = $db->errorNo();
 
print $e;
 
/*
 * returns: 'ORA-00001'
 */
v5/reference/connection/errorno.txt · Last modified: by mnewnham