mysql_select_db()

2023-07-26 02:37:19  Updated

You can call the mysql_select_db() function to set the database specified by db as the default (current) database on the connection specified by mysql.

Syntax

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

Return values

0 is returned for an execution success, and a non-zero value is returned for errors.

Errors

  • CR_COMMANDS_OUT_OF_SYNC: Commands were executed in an improper order.

  • CR_SERVER_GONE_ERROR: The connection to the OBServer was disconnected.

  • CR_SERVER_LOST: The connection to the server was lost during the query.

  • CR_UNKNOWN_ERROR: An unknown error occurred.

Notes

The logged-on user must have the privilege to use the database specified by the db argument or an object in the database. Otherwise, mysql_select_db() fails.

Contact Us