To connect your web page to your MySQL database:
You will now be connected to the database and can run MySQL operations on it via PHP. For more information, see PHP: MySQL Functions
- Enable CGI
- To check if your CGI is enabled, go to /controlpanel/settings.bml
If your CGI is enabled, you will see CGI Active.
If CGI is not enabled, go to /controlpanel/powerpack/checkCGI.bml to enable it.
- In your php script, include the following lines of code that specify the username, host, password, and database name so that any future changes would only have to be done once:
$username = "username";
$password = "password";
Where "username" is your database username, "AcctUsername" is your hosting account username, "password" is your database password, and "your_database" is the name of your database.
- To start a database connection, include the following line of code next:
$conn = mysql_connect($host,$username,$password);
Note that you need to name your connection. You will need this name in the next step.
- Then, select the specific database you wish to use by including this line of code: