Page 1 of 1

A "loading..." message while some PHP is being executed?

Posted: Fri Apr 17, 2009 6:16 am
by anon_amos
I have a chunk of php code that may take some time to run.

Before I execute this, I want a short message saying "Loading..." or something similar.

However, it seems that my PHP isn't being executed at runtime, so if I echo this message before the chunk of php, it doesn't show up, and the user is left looking at a blank page until the script is finished.

How do I get around this?

help appreciated.

Re: A "loading..." message while some PHP is being executed?

Posted: Fri Apr 17, 2009 6:57 am
by Eran
There is a way to do this, by flushing the output buffer before you start the heavy lifting -http://www.php.net/manual/en/function.flush.php
Read the fine print in the manual - you might need to use both flush() and ob_flush() depending on your server software, and gzipping can interfere as well.