note 30388 added to function.set-time-limit
| From: | www dot id dot com dot ua at rack1 dot php dot net | Date: | Sun, 16 Mar 2003 12:50:22 +0000 |
| Subject: | note 30388 added to function.set-time-limit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45388@lists.php.net to get a copy of this message | ||
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
...
--
http://www.php.net/manual/en/function.set-time-limit.php
http://master.php.net/manage/user-notes.php?action=edit+30388
http://master.php.net/manage/user-notes.php?action=delete+30388
http://master.php.net/manage/user-notes.php?action=reject+30388