- Back to Home »
- Internet Tricks »
- Selecting database using alternative methods in PHP
Posted by : Rohit Motwani
Tuesday, 5 June 2012
Most of the time we usemysql_select_db() to select a mysqldatabase, the syntax is
The above syntax results a boolean value, i.e. either true (1) or false(0).
mysql_select_db( db_name, connection );
The above syntax results a boolean value, i.e. either true (1) or false(0).
Alternatively, you can use MySQL command:
USE database_name
Let me show you how to use it with PHP. You can implement the above MySQL command as with other MySQL commands
For example,
$query = "USE database_name;";
mysql_query($query, $connection);
This will select the database named database_name.