Look at this one and compair the two:
function connect_db()
{
$DBhost = "servername";//change this line
$DBuser = "****";//change this line "****"
$DBpass = "********";//change this line "********"
$DBName = "nameofdatabase";//change this line ""
$conn = mysql_connect($DBhost , $DBuser, $DBpass,$DBName)
or die("There was a problem connecting to MySQL. Please try again later.");
if (!@mysql_select_db("nameofdatabase", $conn))//change this line ""
{
die ("There was a problem connecting to the database. Please try again later.");
}
return $conn;
}
?>
Notice that he has a variable there for the database name.
|