Jump to content

mysql problem


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...