- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

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/16 17:33 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top