Return to "PHP"
PHP and MySQL are extremely easy to use together; most tutorials and books written regarding PHP should have a section explaining the connection between the MySQL database and PHP.
$connection = mysql_pconnect(“localhost”,“username“,”password“)
or print “Error connecting to the server.”;
$db = mysql_select_db(“database_name”, $connection)
or print “Error connecting to the database.”;
Be sure to replace username, password, and database_name with the correct MySQL information. The mysql_pconnect() function is the preferred method of connecting to MySQL; using mysql_connect() could unintentionally degrade the performance of your MySQL server by opening too many connections at once.