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.
A "loading..." message while some PHP is being executed?
Moderator: General Moderators
Re: A "loading..." message while some PHP is being executed?
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.
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.