You can call the mysql_stmt_errno() function to return the error code for the most recently called statement API function.
Syntax
unsigned int j;
mysql_stmt_errno(MYSQL_STMT *stmt)
Return values
An error code value is returned. If no error occurred, 0 is returned.
Errors
None.
Notes
For the statement specified by stmt, mysql_stmt_errno() returns the error code for the most recently called statement API function, which can succeed or fail.
Client error message numbers are listed in the errmsg.h header file. Server error message numbers are listed in mysqld_error.h.
If the failed statement API function was mysql_stmt_close(), do not call mysql_stmt_errno() to obtain the error information because mysql_stmt_close() invalidates the statement handler. We recommend that you call mysql_errno() instead.