odbc_errormsg

string odbc_errormsg([resource conn]) 

Returns an ODBC error code.

Returns:

ODBC error message

Description:

Gets the last error message returned from the ODBC connection identifier. This is the actual error message as opposed to a six-digit code from odbc_error(), and hence is more user-friendly. If a connection identifier is specified, the error relates to that specific connection; otherwise, the last error is returned for any available connection.

Version:

Existing since version 4.0-.5

See also:

odbc_error 

Example:

Check for an error
 $db = odbc_connect("DSN","user","pass"); $sql = "SELECT ProductName, UnitPrice FROM WrongTable"; if (!$result = @odbc_exec($db, $sql)) { echo "Query error! ODBC error: ", odbc_errormsg(); } else ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.