
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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. |
- Related Articles
- Which PHP function is used to disconnect from MySQL database connection?
- Which PHP function is used to establish MySQL database connection using PHP script?
- Which PHP function is used to create a new database?
- Which PHP function is used to delete an existing database?
- Which PHP function is used to create a MySQL table?
- Which PHP function is used to delete an existing MySQL table?
- Which PHP function is used to insert data into an existing MySQL table?
- Which PHP function is used to release cursor memory associated with MySQL result?
- How can we select a MySQL database by using PHP script?
- Which PHP function is used to give the number of rows affected by MySQL query?
- MYSQL - select database?
- Which function in MySQL is used to reverse a particular string?
- MySQL BIT_LENGTH() function is used for which purpose?
- How to select a random record from a MySQL database?
- How Groups function can be used in MySQL SELECT clause?

Advertisements