Dan
Dan

Reputation: 2093

How to get details of the error when db2_exec() returns false?

I am converting an application from MySQL to DB2 - so I am just working with the ibm_db2 php extension for the first time.

If a connection to the database fails, details of the error populate into:

db2_conn_error()
db2_conn_errormsg()

But if an SQL query fails, there doesn't seem to be a function that capture details of the error. In MySQL, mysql_error() would capture the most recent error whether it related to the connection itself, or a specific query.

Is there a way to capture details of the error when a DB2 query (db2_exec) fails?

Upvotes: 1

Views: 986

Answers (1)

Dan
Dan

Reputation: 2093

The answer is:

db2_stmt_error(); db2_stmt_errormsg();

Upvotes: 2

Related Questions