PHP Tutorials
PHP MySQL
Connecting to the MySQL Server
Before you can perform any operation on a database you must connect to the MySQL server. The syntax for performing this operation is simple.
A simplified version of the code is shown below.
<html>
<head>
<title>Connect Server</title>
</head>
<body>
<?php
$link = mysql_connect("localhost","username","password"]) or die("Connect Error: " . mysql_error());
print "Successfully connected.\n";
mysql_close($link);
?>
</body>
</html>
|