The mysqli_select_db() function is used to change the default database for the connection.
bool mysqli::select_db ( string $dbname )
bool mysqli_select_db ( mysqli $link , string $dbname )
Selects the default database to be used when performing queries against the database connection.
The above examples will output:
Default database is test. Default database is world.
Parameter | Description |
---|---|
link | Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init() |
dbname | The database name. |
Returns TRUE on success or FALSE on failure.