mariocesar Posted December 28, 2008 Share Posted December 28, 2008 I runned this registration code on godaddy hosting with no problems, now I run the same code on ippower and give this message " Lost connection to MySQL server during query in ......." here is the config.php code <?php $dbhost='custsql-ipw01.eigbox.net'; $dbusername='digitalz_mario'; $dbuserpass='mario09'; $dbname='digitalz_login'; // connect to the mysql database server. mysql_connect ($dbhost, $dbusername, $dbuserpass); mysql_select_db($dbname) or die('I cannot select the database because: ' . mysql_error()); ?> any idea why, thanks Link to comment https://forums.phpfreaks.com/topic/138606-lost-connection-to-mysql-server-during-query/ Share on other sites More sharing options...
MadTechie Posted December 28, 2008 Share Posted December 28, 2008 Thanx for your details.. It doesn't really help us.. (unless we want to get into your database) are you connecting to the same SQL Server your php script is hosted on ? is the query thats having problems with a long one ? have you contected your new host.. ? Link to comment https://forums.phpfreaks.com/topic/138606-lost-connection-to-mysql-server-during-query/#findComment-724727 Share on other sites More sharing options...
mariocesar Posted December 28, 2008 Author Share Posted December 28, 2008 yes I connected to the same SQL server my php is hosted, I tryed to register as a new user here is the register script <?php if(isset($_POST['Submit'])){ //NEED TO CHECK IF FIELDS ARE FILLED IN if( empty($_POST['name']) && (empty($_POST['email']))){ header( "Location:Messages.php?msg=1" ); exit(); } if( empty($_POST['pw1']) && (empty($_POST['pw2']))){ header( "Location:Messages.php?msg=4" ); exit(); } $name=$_POST['name']; $company=$_POST['company']; $email=$_POST['email']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $zipcode=$_POST['zipcode']; $pw1=$_POST['pw1']; $pw2=$_POST['pw2']; if("$pw1" !== "$pw2" ){ header( "Location:Messages.php?msg=5" ); exit(); } $ip = $_SERVER['REMOTE_ADDR']; //connect to the db server , check if uname exist include('config.php'); $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); if ($num > 0) {//Username already exist header( "Location:Messages.php?msg=6" ); exit; }else{ //if username does not exist insert user details $query=( "INSERT INTO user (uname,company,email,address,city,state,zipcode,pw,date_joined,ip,level) VALUES ('$name', '$company', '$email', '$address', '$city', '$state', '$zipcode', password('$pw1'),NOW(),'$ip','Normal')"); if (@mysql_query ($query)) { header("location:login.php?reg=1"); exit; } } mysql_close(); } ?> when I fill the registration form I got this "Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /hermes/bosweb/web148/b1472/ipw.digitalz/public_html/config.php on line 7", I have been running the same script on a site hosted by Godaddy, and is working fine, now in a site hosted by ippower is not working, do you have any idea why? Link to comment https://forums.phpfreaks.com/topic/138606-lost-connection-to-mysql-server-during-query/#findComment-724749 Share on other sites More sharing options...
MadTechie Posted December 28, 2008 Share Posted December 28, 2008 Your need to check with your New Host,, check theirs FAQ's Link to comment https://forums.phpfreaks.com/topic/138606-lost-connection-to-mysql-server-during-query/#findComment-724873 Share on other sites More sharing options...
PFMaBiSmAd Posted December 28, 2008 Share Posted December 28, 2008 Check the most common reasons for that error as they apply to your data - http://dev.mysql.com/doc/refman/5.0/en/error-lost-connection.html Link to comment https://forums.phpfreaks.com/topic/138606-lost-connection-to-mysql-server-during-query/#findComment-724875 Share on other sites More sharing options...
fenway Posted December 29, 2008 Share Posted December 29, 2008 Double-post.. you've been warned. Link to comment https://forums.phpfreaks.com/topic/138606-lost-connection-to-mysql-server-during-query/#findComment-725727 Share on other sites More sharing options...
Recommended Posts