Connect to mysql server
Posted on 2004-08-26
I am very, very new to php, and had a couple questions.
I want to connect to a mysql server, so I do this using mysql_connect and this handy function I found online
$user = "user";
$pass = "pass";
$db = "db";
$link = mysql_connect( "localhost", $user, $pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );
print "Successfully connected to server<P>";
mysql_select_db( $db )
or die ( "Couldn't open $db: ".mysql_error() );
print "Successfully selected database \"$db\"<P>";
mysql_close( $link );
Now it doesn't work right away, I would like to know how to point to the server, I don't believe it is localhost, do I just ask my server admin, or is there some secret?