Zosimas
Zosimas

Reputation: 508

Mysql Error Handling

Is there a way to get the mysql error string message when we only know the code number of the error, taken by mysql_errno() command?

Upvotes: 0

Views: 384

Answers (3)

fyr
fyr

Reputation: 20859

You can get information about what sort of error fired (see e.g.: server error messages). But you cant associate the error code to the detail error message. So the mapping will give you the type of error which happened but:

mysql_error()

will always give more information in addition to mysql_errno.

Upvotes: 1

Bjoern
Bjoern

Reputation: 16304

The command mysql_errno() doesn't just return a number, in most cases it is used hand in hands with mysql_error. You can use mysql_error to return the text of the error message from previous MySQL operation.

If you encounter a case where it doesn't return some text, refer this section in the Mysql-documentation: http://dev.mysql.com/doc/refman/5.5/en/error-handling.html

Upvotes: 1

CristiC
CristiC

Reputation: 22698

There can be server or client errors.

See here: http://dev.mysql.com/doc/refman/5.0/en/error-handling.html

Upvotes: 1

Related Questions