September 2001
Intermediate to advanced
768 pages
32h 45m
English
string odbc_error(resource conn) Returns an ODBC error code.
Returns:
ODBC error code
Description:
Gets the last error code returned from the ODBC connection identifier. This is a six-digit code. More information can be obtained by also using the odbc_errormsg() function. 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_errormsg
Example:
$db = odbc_connect("DSN","user","pass"); $sql = "SELECT ProductName, UnitPrice FROM WrongTable"; if (!$result = @odbc_exec($db, $sql)) { echo "Query error! ODBC code: ", odbc_error(); } else { while (odbc_fetch_into($result, ... |
Read now
Unlock full access