odbc_error
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:
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 code: ", odbc_error(); } else { while (odbc_fetch_into($result, ... |
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.