Name

mysql_error —

Synopsis

char *mysql_error(MYSQL *mysql)

Returns the error message of the last error associated with the current connection. If there have been no errors in the connection, the function returns an empty string. Error messages originating on the server will always be in the language used by the server (chosen at startup time with the --language option). The language of the client error messages can be chosen when compiling the client library. At the time of this writing, MySQL supports the following languages: Czech, Danish, Dutch, English, Estonian, French, German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian (standard and ny), Polish, Portuguese, Romanian, Russian, Slovak, Spanish, and Swedish.

Example

printf("The last error was '%s'\n", mysql_error(&mysql));

Get Managing & Using MySQL, 2nd Edition 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.