After we have establish the connection in MySQL server, we have to select a database. To do that we are going to use the mysql_select_db() function.
databasename – the database name you want to use.
connection – Specifies the MySQL connection
<?php $conn = mysql_connect("localhost","root","") or die("could not connect"); @mysql_select_db("employee",$conn) or die("could not select database!"); ?>
In our example we have first establish a connection in our MySQL server. Then we have selected the database employee (the name of our database) using the mysql_select_db() function. The die statement will be executed if the connection fails.