ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:errormsg

This is an old revision of the document!


errorMsg

Syntax
string errorMsg()

Description

The function errorMsg returns an unfriendly message about the last known error. The message may contain database specific notices.


Usage

/*
 * IBM DB2 database connection assumed
 */
 
/*
 * An invalid SQL statement with mis-matched quotes
 */
$SQL = 'SELECT * FROM ACT WHERE ACT_DESC = "1234';
 
/*
 * Execute the statement, suppressing any errors
 */
$desc = @$db->getOne($SQL);
 
/*
 * Get the last error message
 */
$e = $db->errorMsg();
 
print $e;
 
/*
 * returns: [IBM][CLI Driver][DB2/LINUXX8664] SQL0010N  The string constant 
 * beginning with "'ABCD" does not have an ending string delimiter.  SQLSTATE=42603 SQLCODE=-10
 * PHP Fatal error:  Call to a member function FetchRow() on boolean in /root/db2/test12.php on line 15
 */
v5/reference/connection/errormsg.1452648638.txt.gz · Last modified: 2017/04/21 11:35 (external edit)