A simple php script to open a connection to a database
$dbhost = 'localhost';
$dbuser = 'db username';
$dbpass = 'db password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'db name';
mysql_select_db($dbname);
?>
Save this as
include '
to the top of a php script and the database can be queried using standard sql commands.