Name

mysql_select_db( )

Synopsis

int mysql_select_db(MYSQL *mysql, const char *database)

Use this to select a different database for the current connection. The name of the new database to use is given as the second argument of the function. It returns 0 if successful, nonzero if unsuccessful.

...
mysql = mysql_init(NULL);
mysql_connect(mysql,"localhost","hui","shorty");
mysql_select_db(mysql,"workrequests");
...

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.