I am trying to output an update string when the loop is running to let the user know that the page is not stuck and it is running.
My code is running on google app engine and the loop part is like this.
while (($data = fgetcsv($file, 10000, ",")) !== FALSE) {
$STH = $DBH->prepare("INSERT INTO DB");
$STH->execute();
echo "<p>Please wait. How about a glass of water while it is running? </p>";
}
It is part of a code that checks a list of users from a CSV file and makes sure the DB is updated with the latest change. So this part is the insert part. What happens now is that it will not display the echo statement until the whole script is executed and I end up with a lot of lines of text.
I was wondering if we could output the echo when the loop is being executed. When I googled it seems that flush() and ob_flush() were used but it didn't work with google app engine. Some said to use task queues but cant find a decent tutorial that explains how to use task queues.
I was hoping some one would be able to help create one for novice users who want to use task queues. I am sure it will be very helpful when a person is running a loop and getting the output as it runs.
links for google documentation
https://cloud.google.com/appengine/docs/php/taskqueue/overview-push https://cloud.google.com/appengine/docs/php/config/queue