Jump to content


Photo

PHP Wait Screen


  • Please log in to reply
7 replies to this topic

#1 kid_drew

kid_drew
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 11 September 2006 - 10:30 PM

Does anyone know of a good way to implement a wait screen while some large query is being computed?  I can create a wait screen with a nice animated gif and all that, but I'm not sure how to do the timing.  I.e., how do you immediately go to another page after a form submit and wait at that screen until the data is ready then load the results page, or is that even possible in php?

#2 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 11 September 2006 - 10:32 PM

Hmmm, if you knew how long it would take everytime you could arrange it, but i doubt thats the circumstances.
Why doesn't anyone ever say hi, hey, or whad up world?

#3 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 11 September 2006 - 10:46 PM

Don't quote me on this but I don't believe there is a PHP "pause" function.  At least not one that is easily done.

I KNOW this can be done with AJAX and I've even seen a few tutorials on the web.  I'm sure Google can help there.  If anything you can use the javascript settime() function (pretty sure that's the one) to give it (x) amount of time before refreshing the page.  Just my 2 cents!
I'm considered good looking in some countries

#4 kid_drew

kid_drew
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 11 September 2006 - 11:10 PM

What about the fork() function?  Could you fork to run the query process in the background, run a do/while loop on your wait screen and redirect only when the forked process updates a session variable, or something similar?

I've never used fork, so I'm totally shooting in the dark.

#5 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 11 September 2006 - 11:20 PM

Ive never used fork either...
Why doesn't anyone ever say hi, hey, or whad up world?

#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 11 September 2006 - 11:24 PM

How long does a 'large query' take before it returns results ... and how long does it take to download whatever it is that tells the user to wait (as if they had any choice)?
Legend has it that reading the manual never killed anyone.
My site

#7 kid_drew

kid_drew
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 12 September 2006 - 03:40 AM

I'm not sure how long the longer queries are going to take.  I don't have any traffic yet.  =)

I think they have the potential to take 10-20 seconds.

#8 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 05:51 AM

I know this isn't the "best" programming practice but a decent way to half-ass the solution would be to pop open a div when the user presses the submit button.  Basically the page will hang while the query is being performed so the <div> will stay open until the query is finished and the new page loads.

Maybe you could post to a new page that performs the query and throw a header() after the query is performed to redirect to the results.  I'm just throwing things out here = /
I'm considered good looking in some countries




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users