PHP mysqli_select_db() Function is used to choose database for the connection. Also You can select the default database using 4th parameter in mysqli_connect() function.
PHP Version : PHP 5, PHP 7
Syntax for mysqli_select_db:
According to Procedural
mysqli_select_db($connection, $database_name);
According to Object oriented
$mysqli -> select_db($database_name);
Parameter,
$connection : Required. It is MySQL connection object which is return by mysqli_connect() function.
$database_name : Required. It is database name.
Return values for mysqli_connect:
It returns TRUE on success and FALSE on failure.
Example for mysqli_connect:
Let's see below example to understand php mysqli_select_db() Function in details.
Comments