Here goes the simple database connectivity procedure.
$ref = mysql_connect("localhost","username","password");
if(!$ref)
{
die("Could not connect to the database",mysql_error());
}
else
{
//user operations like selection of databses,insert query,update query,etc....
}