Jump to content

mysql problem


Abarrow

Recommended Posts

Hi, I have an account off a server (I don't own the server) and it's mysql enabled. Here's my code for connecting to the server:

<?php$con = mysql_connect("server:port","username","password");if (!$con)  {  die('Could not connect: ' . mysql_error());  }?>

(When I refer to a generic title such as port or user name I'm right the proper one in my code but not here)Unfortunately I get a warning and die excecutes:Warning: mysql_connect(): Lost connection to MySQL server during query in (page location on server) on line2

Link to comment
Share on other sites

That's a new error message. Do you get the same error every time you run the page, or rarely? It seems like MySQL is being restarted while you're trying to run your page. If the error keeps happening contact your host about it and see what they say. You also might want to remove the port from the address, if the port is 3306 then that is the default port and you can leave it out (although I don't see how that would cause an error like that).

Link to comment
Share on other sites

Hi, I have an account off a server (I don't own the server) and it's mysql enabled. Here's my code for connecting to the server:
<?php$con = mysql_connect("server:port","username","password");if (!$con)  {  die('Could not connect: ' . mysql_error());  }?>

(When I refer to a generic title such as port or user name I'm right the proper one in my code but not here)Unfortunately I get a warning and die excecutes:Warning: mysql_connect(): Lost connection to MySQL server during query in (page location on server) on line2

Should you be using single (') quotes for all parameters? Worth a try. Suggest also try 'localhost' instead of "server:port".
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...