note 30388 deleted from function.set-time-limit by nlopess
| From: | nlopess@php.net | Date: | Wed, 04 Feb 2004 17:03:05 +0000 |
| Subject: | note 30388 deleted from function.set-time-limit by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64642@lists.php.net to get a copy of this message | ||
Note Submitter: www.id.com.ua Rudenko Ilya
----
So if you use dynamic content, size of which always diffrent
and you didn't know how long your script should execute. But you
can calculate duration of one while iteration. Use set_time_limit()
inside while directive. So if script work is normal you never get
"maximum execution time error", but if it have error inside while
control structure it will be breaked with error.
Example:
...
WHILE($list = mysql_fetch_assoc($result) {
set_time_limit(2); // Timelimit 2 seconds for sending each mail
mail($list[email], $list[Subject], $list[Message]);
}
set_time_limit(5); // Timelimit to finish script
...