Having successfully connected to MySQL, you are now ready to select the database that you will be using. Consider the following example :
<?php mysql_select_db($db_database) or die("Unable to select database: " . mysql_error()); ?>
The command to select the database is mysql_select_db. Pass it the name of the database you want and the server to which you connected. As with the previous example, a die statement has been included to provide an error message and explanation, should the selection fail—the only difference being that there has been no need to retain the return value from the mysql_select_db function, as it simply returns either TRUE or FALSE. Therefore the PHP or statement was used, which means “if the previous command failed, do the following.” Note that for the or to work, there must be no semicolon at the end of the first line of code.