$conn = mysqli_connect('localhost', 'username', 'password'); mysqli_select_db($conn, 'database_name');
$conn = mysqli_connect('localhost', 'username', 'password'); if ($conn){ mysqli_select_db($conn, 'database_name'); echo "Connected to database successfully"; } else { die("Database connection error"); }This example demonstrates how to check if the database connection is successful or not. If the connection is successful, the mysqli_select_db function is called to select the ‘database_name’ database and a message is printed to the screen. Package Library: The mysqli_select_db function is a part of the mysqli extension library which is a PHP package for connecting to and interacting with MySQL databases.