How do I access my MySQL database using PHP?
The following article explains how to connect to a MySQL database using PHP. A MySQL database can be accessed on our servers using all of the programming languages available on the server. Unlike Perl, PHP contains native MySQL connection support, so it is not necessary to include a module.
In order to access your MySQL database with the PHP, please follow these steps:
Type the following connection string to connect to your database:
$link = mysql_connect(\'host\', \'username\', \'password\') or die(\'Could not connect: \' . mysql_error());
mysql_select_db(\'database\') or die(\'Could not select database\');
- host: enter the MySQL server that you are assigned to, for example, mysql1.media3.net
- username: enter the username provided for your database
- password: enter the password provided for your database
- database: enter the name of the MySQL database