That's all fine and good, but I don't know how to update the span without using JavaScript for each iteration of the loop. I can make it happen all day in ColdFusion and/or JavaScript. There has to be an equivalent PHP solution. I'm all ears! How do I update the span with the incremented value of $count using only PHP?

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I thought that might be the case. How then, do I integrate a script in with the php that will update the count on the client side as the server side processes? I started out by outputting the total count. That is simple. :)

The purpose of updating the count is to entertain the end user. If they see that the page is working, they are less likely to do something stupid, like refreshing the screen while the data is still being processed. My end goal is to display the total, and to display a reverse counter that will count down from the total records being processed to 0. The average records being processed are between 1700 and 1800. As you would expect, that takes quite some time. While there is a loading modal in place during processing, the user may be inclined to think that the process is stuck. The counter would assure them that the process is running, and not stuck.

So... Via my current, and somewhat educated but ignorant, understanding of PHP, I expected that this script (jQuery) would happily update our counter:

I figured it out. For reasons I'm still looking into, jQuery wasn't loaded in the iFrame where all the fun is taking place. I rewrote the script with the standard, non-jQuery equivalent, then changed the class attribute to an id attribute on the counter, and viola! It works.

This iteration simply updates the counter as the data is processed. It moves in chunks rather than one at a time, but it works none the less. I'll post up the reverse iteration when I get it done. Shouldn't be long. Then I'll split the points between y'all and call it done. Thanks for the input guys!

Set the counter variable ($count) and display the initial value. Display the total. Display the $count as 'Records Remaining to Process'. Note: $highestRow is coming from the PHPExcel class. Our data is coming in from a spreadsheet that the end user uploads. This will only work if you are looping a significant amount of records and taking some time to process each. In this case, I am formatting and outputting all of the data to the screen as well as extracting strings from specific columns and creating new column data based off of those strings, then it all goes into the database. It's busy to say the least.

jQuery's progress bar is a great solution, but it wouldn't play nice with what I have. It would be difficult, if not impossible to shut it down when the processing is complete. iFrames suck in that respect. I hate using them, but was left with no option in this instance. Even though I am calling the iFrame through our existing framework, jQuery isn't loading... I'm not sure I want to open that bag of worms at the moment, since everything is working, and I have a great deal of work yet to do and not a lot of time to get it done. I know one thing though, it is being called in through the framework, since I can see the the style sheets are being leveraged. It seems that only jQuery is awol.

I am currently using a Bootstrap modal loading variant that I was easily able to close post to processing completion. It looks great, and in addition to the modal and the loading animation, the user can now see the records count down to 0. It's exactly what I was shooting for.