First page Back Continue Last page Overview Graphics
Connecting to a Database
To connect to a database, we have to open a connection to the server and select the database. (And close the connection when we're done.)
<?php
$db = mysql_connect("hostname", "username",
"password");
mysql_select_db("dbname", $db);
// Do stuff
mysql_close($db);
?>