kid_drew Posted September 11, 2006 Share Posted September 11, 2006 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? Quote Link to comment Share on other sites More sharing options...
corbin Posted September 11, 2006 Share Posted September 11, 2006 Hmmm, if you knew how long it would take everytime you could arrange it, but i doubt thats the circumstances. Quote Link to comment Share on other sites More sharing options...
gijew Posted September 11, 2006 Share Posted September 11, 2006 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! Quote Link to comment Share on other sites More sharing options...
kid_drew Posted September 11, 2006 Author Share Posted September 11, 2006 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. Quote Link to comment Share on other sites More sharing options...
corbin Posted September 11, 2006 Share Posted September 11, 2006 Ive never used fork either... Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 11, 2006 Share Posted September 11, 2006 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)? Quote Link to comment Share on other sites More sharing options...
kid_drew Posted September 12, 2006 Author Share Posted September 12, 2006 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. Quote Link to comment Share on other sites More sharing options...
gijew Posted September 12, 2006 Share Posted September 12, 2006 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 = / Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.