...

View Full Version : Lost connection to MySQL server during query error



kevinkhan
03-29-2010, 12:26 PM
Hi guys..

I have two database, one has 17000 numbers and the other one has only 3 numbers..

When i run the script below using the database with 17000 numbers i get this error "Lost connection to MySQL server during query"

and when i run the script with the the database that has only 3 numbers in it.. the script works perfect...


$config['dbhost'] = 'hostname';
$config['dbuser'] = 'kevin';
$config['dbpass'] = 'password';
$config['dbname'] = 'database with 1700 numbers';


//$config['dbhost'] = 'mysql359int.cp.blacknight.com';
//$config['dbuser'] = 'u1001236_test';
//$config['dbpass'] = 'password';
//$config['dbname'] = 'db1001236_testing';

set_time_limit(0);

ini_set('error_reporting', E_ALL);

error_reporting(E_ERROR | E_WARNING | E_PARSE);

//define the base path for the files
$maindir = dirname(__FILE__) . DIRECTORY_SEPARATOR;


//connect to the databse server and select database.
@mysql_connect($config['dbhost'], $config['dbuser'], $config['dbpass']) or die(mysql_error());
@mysql_select_db($config['dbname']) or die(mysql_error());


$sql = "SELECT * FROM `phone_number` WHERE `phone` NOT IN (SELECT `phone` FROM `phone_number_sent`)";
$rea = @mysql_query($sql) or die(mysql_error());

//define phone list array
$phone_list = array();
// rsa = record set array
while ($rsa=mysql_fetch_array($rea)) {

echo $rsa['phone']."<br />";
//$phone_list[] = array($rsa['phone'], $rsa['source']);
}



Does any body know what the problem might be?

Dormilich
03-29-2010, 01:35 PM
I’d hazard a guess at timing out.

kevinkhan
03-29-2010, 01:40 PM
What do you mean exactly..

how would i go about fixing this? and is there a way i can improve my code to get it to work?

Dormilich
03-29-2010, 01:43 PM
What do you mean exactly..

there is a time limit for a PHP script (to prevent inifinite loops blocking the interpreter)


how would i go about fixing this? and is there a way i can improve my code to get it to work?

Id go for SQL optimization, best ask in the SQL forum.

tomws
03-29-2010, 03:16 PM
When i run the script below using the database with 17000 numbers i get this error "Lost connection to MySQL server during query"


Did you check Google?
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

masterofollies
03-29-2010, 03:52 PM
Increase mysql connection time out in php.ini, variable is mysql.connect_timeout.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum