<?php
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()) ;
mysql_select_db("Database_Name") or die(mysql_error()) ;
?>
The first variable (shown as your.hostaddress.com) is the location of your database. Often this is "localhost". The next two variables are your username and password. This is the login you use for your MySQL database. In the second line, we choose which database you are connecting too. This is needed because the same MySQL username can be linked to several databases.
Once you have connected to the database, you can run any SQL code to access and interact with the information in the database.



