I have the following web php code:
while ($row = mysql_fetch_array($results, MYSQL_NUM))
{
printf("<p>ID: %s</p>", $row[0]);
echo exec ("php analysis.php " .escapeshellcmd($row[0]));
}
For a set of 4k users, the following code takes 15 minutes to execute with the results being displayed in increments of of ~1k users.
I want the results displayed at around the speed that the code is going so that anybody using the page is confused as to weather or not the code works. Is there some way to force the browser to display the data it was sent?
edit:
Flush is not producing noticeably different output.
edit:
My problem remains unresolved? Is there some client server model that can be implemented in JavaScript to facilitate this? Can Javascript open a socket and interrupt on socket data? Maybe using flash(which I know can use sockets…)
echo exec(...)waits before the command is finished. If you do not mind showing partial info, usepassthru(...).Depending on your webserver, flush may work or not. If output buffering is enabled (implicitly using
ob_start()or explicitly in php.ini), ob_flush() needs to be called as well.