How to Create and Use a Connect File
In a text editor, create a file with the following code:

<?
// name of your database
$database = "databasename";

// connect to database
$db = mysql_connect("localhost", "dbuser", "dbpassword")or die ('I cannot connect to the database.');
mysql_select_db("$database",$db);
?>

Be sure to change databasename, dbuser, and dbpassword to your specific info.

Save and upload to your server as connect.php.

Call the connect file in your script by adding the following at the beginning:

<?
//connection info
include ("/path/to/your/connection/file/connect.php");
?>

and update /path/to/your/connection/file/connect.php to point to your connect file.