Right now in order to see the results, I have to wait until the entire code is done executing. It hangs until it\'s complete and stays loading. Once it\'s finished it shows
You can do that with output buffering. Turn on output buffering at the top of your script with ob_start(). That makes PHP to send no output to the browser. Instead its stored internally.
Flush your output at any time with ob_flush(), and the content will be sent to the browser.
But keep in mind that output buffering is influenced by many other factors. I think some versions of IIS will wait until the script is finished, ignoring output buffering. And some Antivirus software on client side (Was it Panda?) might wait until the page is fully loaded before passing it through to the browser.