The first step when dealing with MySQL—connecting to the server—requires the appropriately named mysql_connect() function:
$dbc = mysql_connect ($host, $user, → $password);
The arguments sent to the function (host, username, and password) are based upon the users and privileges set up within the mysql database (see Appendix A, “Installation,” for more information). Commonly (but not always), the host to specify will be localhost (naming a different host will allow you to connect to MySQL running on a different server).
If the connection was made, the $dbc variable will become a reference point for all of your subsequent database interactions. Most of the PHP functions for working with MySQL can ...