PHP Classes

Database Connection

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Database Connection  
Subject:Database Connection
Summary:MYSQL Connection issues
Messages:2
Author:Desmond Mpofu
Date:2013-09-30 13:38:26
Update:2013-10-03 12:17:27
 

  1. Database Connection   Reply   Report abuse  
Picture of Desmond Mpofu Desmond Mpofu - 2013-10-01 00:33:31

We trying to run a MYSQL database based blog and I have problems with simple connecting to the database I created. I used PHP and when I run the site I get this error

"Warning: mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/thenalzk/public_html/conn.php on line 6
Could not connect to the database; Lost connection to MySQL server at 'reading initial communication packet', system error: 111"

This comes from this php file


<?php
define('SQL_HOST','http://www.certainsitename.co.za');
define('SQL_USER','user');
define('SQL_PASS','password');
define('SQL_DB','dbase1');
$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
or die('Could not connect to the database; ' . mysql_error());
mysql_select_db(SQL_DB, $conn)
or die('Could not select database; ' . mysql_error());
?>

Please may you direct me as to what could be the problem? It runs perfectly on my local server.

Regards
Desmond

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.