Hey guyz/galz,
Just threw this mysql_connect function together while looking at the PHP.net site. In theory it should work by all syntax they supply from the site but i am unable to get a good connection. It gives me this error message....i even put in some debug tracers but they never evaluate.
QUOTE
Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /homepages/3/d226734254/htdocs/test/pbbg5/db.php on line 13
The connection to the database is currently down for maintenance, please try again after awhile!
here is the code i am trying to evaluate.
php
function connectDb()
{
$dbserver &= ":3307";
global $dbconnect;
if ($dbconnect){
return $dbconnect;
}
echo "$dbserver";
echo "$dbuid";
echo "$dbpwd";
echo "$dbname";
$dbconnect = mysql_connect($dbserver, $dbuid, $dbpwd, TRUE); //line 13 in my editor
if (!$dbconnect){
echo "The connection to the database is currently down for maintenance, please try again after awhile!";
return $dbconnect;
}
echo "db.php:connectDB |Connection made!";
mysql_select_db($dbname, $dbconnect) or die("The database is currently unavailable, please be patient");
echo "db.php:connectDB |Database Connected!";
return $dbconnect;
}
I have done a google on it but most everything relies on the fact that i am running my own server or it is Windows based. My server is Unix and is hosted on 1and1....this code page is located on their server so shouldnt be an issue of accessing the sql server.
This post has been edited by woodjom: 24 Jul, 2008 - 07:50 PM