Code:
<?php
$username = "db_username";
$password = "db_password";
$database = "db_name";
$hostname = "localhost";
$conn = mysql_connect("$hostname", "$username", "$password")
or die("Invalid server or user.");
mysql_select_db("$database", $conn);
?> The first group of variables determines the database which should
be connected to and which user has rights to connect to it.
Your connection variable, tells the script to either connect to the
database or die if no connection could be made.
Code:
$conn = mysql_connect("$hostname", "$username", "$password")
or die("Invalid server or user."); ---
The next php function selects the mysql database and allows you to
pull data from it.
Code:
mysql_select_db("$database", $conn);