spen_lang
asked on
Progress Bar in While Loop
Is there any way to do a while loop with a progress bar?
My idea is for the script to return how many results in the SELECT statement before it does it's while loop - and use the amount of results to divide up a progress bar.
then each time the loop runs it will add a bit more to the progress bar.
This is only what I have thought about in my head - I have no idea if this will work or indeed if this is the best way to do it?
basically I'm trying to stop my script timing out. Because the script takes quite a long time to execute, the browser is timing out - so I need a way of keeping the browser responding for the duration of the while loop.
Any one have any ideas?
My idea is for the script to return how many results in the SELECT statement before it does it's while loop - and use the amount of results to divide up a progress bar.
then each time the loop runs it will add a bit more to the progress bar.
This is only what I have thought about in my head - I have no idea if this will work or indeed if this is the best way to do it?
basically I'm trying to stop my script timing out. Because the script takes quite a long time to execute, the browser is timing out - so I need a way of keeping the browser responding for the duration of the while loop.
Any one have any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the points! It's a good question, ~Ray
To keep the page from timing out, just use set_time_limit(0); at the top of your script. This MIGHT NOT WORK if you are using a shared host, though. You might want to test it or ask them before using it for production code.