Which PHP function is used to select a MySQL database?


PHP uses mysql_select_db function to select a MySQL database. This function takes two parameters and returns TRUE on success or FALSE on failure. Its syntax is as follows −

Syntax

bool mysql_select_db( db_name, connection );

Followings are the parameters used in this function:

Sr.No
Parameter & Description
1
db_name
Required - MySQL database name to be selected
2
connection
Optional - if not specified, then the last opened connection by mysql_connect will be used.

Updated on: 22-Jun-2020

110 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements