Flushing HTML to browser while looping
Posted: Fri Feb 10, 2006 4:30 pm
Hi,
I have a problem regarding flushing the output buffer to the browser while walking through a for-loop. I want to show a progress bar while my mailing list sending routine is executing. To keep things simple see the following simplified snippet:
The strange thing is: when running the script (which, on average, takes about 1 minute), the output seems to be flushed when viewing the source code of the page during the execution, but the output is not being rendered to the screen by the browser.
What could be the problem and is there a solution?
Thanks in advance!
I have a problem regarding flushing the output buffer to the browser while walking through a for-loop. I want to show a progress bar while my mailing list sending routine is executing. To keep things simple see the following simplified snippet:
Code: Select all
for($i = 0; $i < count($addresses); $i++)
{
mail(...);
echo ".";
ob_flush();
flush();
sleep(1);
}What could be the problem and is there a solution?
Thanks in advance!