Two ways we deal with long running scripts like this are:
1) Run it from the command line. Usually, PHP drives web pages... But it
can be used as a scripting language just like perl. Beginning the script
with set_time_limit(0) kills the timeout. Also, running from the command
line gets around all the weird browser display issues that one sometimes
sees.
2) Mark your place as you go. Maybe include a field called something
like lastSent. When each email goes out, mark it. That way, you can
recover it later if something happens.

        -- jon

-------------------
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 7:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Script timeout?


Hello Ben,

On 27 Jan 2004 at 9:27, Ben Ramsey wrote:

> I'm trying to run a query against a database with a PHP script that
> cycles through each record (about 4,000+) and sends and e-mail to them

> if they have an e-mail address present.  The problem is that everytime
I 
> do this, it processes about 430 records and stops.  There is no error 
> message generated.  Could this be due to a script timeout?  If so, how

> do I raise the timeout value?

Look up set_time_limit in the PHP manual. Also, consider retrieving all
the records first 
with a single db query, storing all e-mails in an array, and then
sending out the e-mails 
in a separate operation. Why query your db 4000+ times when you can
query it only  
once?

Good luck,

Erik

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to