CodeIgniter Forums
Long running script needs love - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Long running script needs love (/showthread.php?tid=12439)



Long running script needs love - El Forum - 10-19-2008

[eluser]Chris Williams[/eluser]
I'm running a script that does some clean up to my database. It's a loop that will time out.

How can I tell my script to output updates?

I put in echo statements, but they don't load into the page until the page has already timed out.


Long running script needs love - El Forum - 10-19-2008

[eluser]manilodisan[/eluser]
use ob_flush(); and flush(); after each echo...
Code:
for ( $i=0; $i<100; $i++ )
{
    echo $i . '<br />';
    ob_flush ();
    flush ();

    usleep ( 300000 );
}