Making a Please wait screen while looping database
Moderator: General Moderators
Making a Please wait screen while looping database
Well heres my doubt.. i have to make a HUGE query to the database.. im talking about 5000+ querys in one loop... so i was wondering how do i make a waiting screen while the results are shown..
i usually get all the htm ito a variable and then at the end i print it out..
i did something with javascript opening another window and shile looping i send informtion to a textbox in the new opened window.. but my prolem is that the echo that sends the info to the other window doesnt do it continusly.. for example.
when i enter page 1 (the one that makes the querys), i make an ECHO and open the new window but that doesnt occur inmeaditly it happens just 2 or 3 seconds after entering the page.. and then while looping i make another echo everytime it loops ,. but the "counter" in the other page doesnt refresh inmedialty.. its smething like php waits n seconds or something to return data to the browser.
Any help here?.. how can i tell PHP that i want the data to be echo every tiem it llops..
Thnaks in advance.. sorry for my english. if something here that you could understand please ask me..
Thanks again!
i usually get all the htm ito a variable and then at the end i print it out..
i did something with javascript opening another window and shile looping i send informtion to a textbox in the new opened window.. but my prolem is that the echo that sends the info to the other window doesnt do it continusly.. for example.
when i enter page 1 (the one that makes the querys), i make an ECHO and open the new window but that doesnt occur inmeaditly it happens just 2 or 3 seconds after entering the page.. and then while looping i make another echo everytime it loops ,. but the "counter" in the other page doesnt refresh inmedialty.. its smething like php waits n seconds or something to return data to the browser.
Any help here?.. how can i tell PHP that i want the data to be echo every tiem it llops..
Thnaks in advance.. sorry for my english. if something here that you could understand please ask me..
Thanks again!
Microsoft Explorer needs a bit of data outputted to it before it will render an incomplete page. A good way to do that is to put in a large amount of garbage text inside HTML comments. That will cause IE to render anything that follows. Then, as feyd says, use flush() to output your update messages. Also remember, you can output <script>...</script> blocks between flushes, and these scripts can update DHTML elements in your page as they go. This lets you have a visually very nice page showing a constantly-updated display. (Just make sure to have the entire script block outputted between flushes, not just adding to an existing block, otherwise the script isn't executed on-the-fly, but when you close the script tag)
Read my posts in this thread for a nice way of doing things
viewtopic.php?t=12436&start=0&postdays= ... ight=sleep
Mark
viewtopic.php?t=12436&start=0&postdays= ... ight=sleep
Mark
Using the DIV tag and the style visibility and inline is the way to go - like Bech100's link says. I also use the innerHTML tag for IE to change the text while looping. I use this extensively and it makes the page and the loading quite attractive. But if you're doing 5000 actual queries, you should revamp your script. Hopefully you mean 5000 records - this isn't much though.
thanks for all your replies.. i did it in these way..
I was printing ALL the data after it was collected.. but i did a work around for this and entering the function i make an ECHO for a javascript that opens a new window using the FLUSH() function then, inside the loop of the query i use another echo and flush for sending the progress in percentage to the new window opened in a form. thants the way i did it..
Thanks!
I was printing ALL the data after it was collected.. but i did a work around for this and entering the function i make an ECHO for a javascript that opens a new window using the FLUSH() function then, inside the loop of the query i use another echo and flush for sending the progress in percentage to the new window opened in a form. thants the way i did it..
Thanks!