This is a basic script that is needed by any PHP scripter if they are using MySQL in any script:
?
//set the variables as required
$dbhost = "mysite.com";
$dbuser = "username";
$dbpass = "password";
$dbname = "database_name";
//do not edit this, it connects the script
$db = mysql_pconnect($dbhost,$dbuser,$dbpass);
mysql_select_db("$dbname",$db);
?>
Sometimes it\'s a good idea to define the constants, it makes it more secure.
<?
//set the variables as required
define (DBHOST, \'mysite.com\');
define (DBUSER, \'username\');
define (DBPASS, \'password\');
define (DBNAME, \'database_name\');
//do not edit this, it connects the script
mysql_connect (DBHOST, DBUSER, DBPASS);
mysql_select_db (DBNAME) OR die (mysql_error ());
?>
you missed some stuff
<?
//set the variables as required
$dbhost = \"mysite.com\";
$dbuser = \"username\";
$dbpass = \"password\";
$dbname = \"database_name\";
//do not edit this, it connects the script
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname) or die(mysql_error());
?>
<\'s are nice in front of a php tag :P
also the or die is for security reasons and is helpfull