Help - Search - Members - Calendar
Full Version: Trouble Connecting To Db With Php
Zymic Webmaster Forums > Zymic Free Web Hosting > Databases & MySQL
BBetances
I am using PHP to create a simple site. I am a C#/ASP.NET expert, but that is not practical for the site im making. I've dabbled in PHP in the past, and am also we versed in Delphi (not relevant.) When I try to connect to my MySQL database, I use this syntax:

CODE
<?php
$conn = mysql_connect("uuqu.com","paulasplace_sudo","mypassword");
if(!$con)
{
die("Could not connect: " . mysql_error());
}
else
{
echo("mysql connected successfully!");
}
?>


I get this error:

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110 in /www/uuuq.com/p/a/u/paulasplace/htdocs/index.php on line 9
Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 110

Then I try:

CODE
<?php
$conn = mysql_connect("paulasplace.uuqu.com","paulasplace_sudo","mypassword");
if(!$con)
{
die("Could not connect: " . mysql_error());
}
else
{
echo("mysql connected successfully!");
}
?>


and I get the same, or a Could not connect error. This user has full privileges. Any idea what could be wrong?

Thanks in advance.
BBetances
EDIT: NVM, i got it working. I called the wrong variable in the if statement.

QUOTE(BBetances @ Feb 27 2009, 04:36 AM) *
I am using PHP to create a simple site. I am a C#/ASP.NET expert, but that is not practical for the site im making. I've dabbled in PHP in the past, and am also we versed in Delphi (not relevant.) When I try to connect to my MySQL database, I use this syntax:

CODE
<?php
$conn = mysql_connect("uuqu.com","paulasplace_sudo","mypassword");
if(!$con)
{
die("Could not connect: " . mysql_error());
}
else
{
echo("mysql connected successfully!");
}
?>


I get this error:

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110 in /www/uuuq.com/p/a/u/paulasplace/htdocs/index.php on line 9
Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 110

Then I try:

CODE
<?php
$conn = mysql_connect("paulasplace.uuqu.com","paulasplace_sudo","mypassword");
if(!$con)
{
die("Could not connect: " . mysql_error());
}
else
{
echo("mysql connected successfully!");
}
?>


and I get the same, or a Could not connect error. This user has full privileges. Any idea what could be wrong?

Thanks in advance.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.