Name
mysql_error( )
Synopsis
char *mysql_error(MYSQL *mysql)
This returns the error message for the last function executed that failed. After a successfully executed function, an empty string is returned from this function.
... if(!mysql_real_connect(mysql,host,"goofy", password,database,0,NULL,0)) { printf("Error Message: %s \n", mysql_error(mysql)); exit(EXIT FAILURE); } ...
In this example, the program is attempting to connect to the MySQL server with a user who is not in the mysql database.
Get MySQL in a Nutshell 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.