Store the connection in a variable ($con) for later use in the script:
<?php
// Create connection
$con = mysql_connect("dbhost", "dbuser ", "dbpass ", "dbname");
// Check connection
if (mysql_connect_error())
{
echo "Failed to connect to MySQL: " . mysql_connect_error();
}
?>
