This is a sample script to connect to mysql database using php.

<?php
mysql_connect(”mysql server - ususally will be localhost”, “user name”, “password for user”) or die(mysql_error());
echo “Connected to MySQL<br />”;
mysql_select_db(”testdatabase”) or die(mysql_error());
echo “Connected to Database”;
?>