20.4.12 mysql_error()

char *mysql_error(MYSQL *mysql)

20.4.12.1 Description

For the connection specified by mysql, mysql_error() returns the error message for the most recently invoked API function that can succeed or fail. An empty string ("") is returned if no error occurred. This means the following two tests are equivalent:

if(mysql_errno(&mysql))
{
    // an error occurred
}

if(mysql_error(&mysql)[0] != '\0')
{
    // an error occurred
}

The language of the client error messages may be changed by recompiling the MySQL client library. Currently you can choose error messages in several different languages. 9.1 Quels sont les langues supportés par MySQL?.

20.4.12.2 Return values

A character string that describes the error. An empty string if no error occurred.

20.4.12.3 Errors

None.