Jump to content

Lost connection to MySQL server during query


mariocesar

Recommended Posts

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

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

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.