How do I connect to my MySQL databases through PHP?

Use the following outline to connect and query the MySQL server from within your PHP scripts. 

1. Connect To The mySQL Server
Use the following statement to connect to the database server. Substitute the username, and password for the ones you created. 

MYSQL_CONNECT('localhost','USERNAME','PASSWORD');

2. Select Your Database 
Use the following statement to select the database. Make sure you substitute the example with your database name. 

@mysql_select_db("DATABASENAME"); 

For more information on accessing your MySQL databases through PHP, please visit http://www.php-mysql-tutorial.com/connect-to-mysql-using-php.php .

  • 0 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Seotud artiklid

How to Rename a Database in cPanel

1. Log in to your cPanel account. 2. In the Databases section, click on MySQL Databases. 3....

How do I create a MySQL database?

Overview MySQL databases allow you to store lots of information in an easy to access manner. The...

How to Repair a Database via phpMyAdmin in cPanel

1. Log in to your cPanel account.2. In the Databases section, click on phpMyAdmin.3. Click the...

How do I delete a MySQL database?

Overview You can easily delete a MySQL database from your web hosting account. Follow the...

How to Delete a Database Table via phpMyAdmin in cPanel

1. Log in to your cPanel account.2. In the Databases section, click on phpMyAdmin. 3. Click on...