v5:reference:connection:errormsg
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.txt · Last modified: 2016/01/17 02:33 by mnewnham