Re: losing mysql connection during cron job

From: Date: Thu, 19 Jun 2008 05:30:48 +0000
Subject: Re: losing mysql connection during cron job
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-275571@lists.php.net to get a copy of this message
At 6/18/2008 04:49 PM, Shiplu wrote:
why don't you edit your code?
       foreach (recipients as batch)
       {
               mail() using batch of recipients;
               mysql_query() update table;
               if(mysql_errno()==ERROR_CODE_YOU_GET){
                         mysql_connect();
                         mysql_select_db();
               }
               sleep(60);
       }
Thanks for the suggestion. I am currently successfully working around this error by another method, although your suggestion is probably better. The reason I posted this problem, though, is that I want to understand *why* I'm getting the "Lost connection to MySQL server during query" error. If anyone has had a similar experience using cron jobs or sleep() I'd love to hear from you. Thanks, Paul

« previous php.general (#275571) next »