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 Користувачі, які знайшли це корисним
Ця відповідь Вам допомогла?

Схожі статті

How to Create a Database Username in cPanel

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

How to Create a Database in cPanel

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

How do connect to a MySQL database through Perl?

Use the following outline to connect and query the MySQL server from a Perl script. 1....

How do I repair my MySQL database?

Overview You can repair your MySQL database by using the "Repair DB" feature in cPanel. Steps...

How do I setup remote access to my MySQL databases?

Overview Remote MySQL allows external web servers to access your MySQL databases by adding their...