Accredited Registrar Accredited Registrar

Frequently Asked Question

FAQ / Linux Shared Hosting


How to check the PHP MYSQL connection Test file?

If you wish to check the MYSQL test file connection, then copy the below given code and paste it in the test.php file and execute it in your web browser. Through the results, you can check the connection of the file.

In case you do not receive the output, you should approach your service provider.

Code:


$link = mysql_connect ('localhost', '', '');

if (!$link) {

die('Could not connect: ' . mysql_error() );

}

echo 'Connected successfully';

$db_selected = mysql_select_db('', $link);

if (!$db_selected) {

die ('Can't use foo : ' . mysql_error() );

}

mysql_close($link);

?>

* In the above code, you should replace the 'username, password and database' with your login details and database name.

How this faq is helpful:

Not at all
helpful
Not much
helpful
Some what
helpful
Very
helpful
Extremely
helpful

What could be better? (Optional)
X
  Not related to my issue
  Too complicated explanations
  Too much information
  Incorrect information
  Unclear information
  Incomplete information
  Too old information
Do you have any other feedback about this faq ?
1000

Related Tags :