Forum Moderators: coopster

Message Too Old, No Replies

Print message immediately

while waiting for the results to display

         

rover

6:08 pm on Apr 1, 2005 (gmt 0)

10+ Year Member



I have a php page that does some mysql calculations and then returns results. For some cases it might take several seconds before the results are returned.

Is there a way to immediately echo a message that the calculations are taking place, and the results will be shown shortly? (rather than having the user look at a blank screen and wonder if things are working or not?)

If someone can point me in the right direction, I would appreciate it very much.

jatar_k

8:04 pm on Apr 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



In this case I often put a message up before they click the link, that it could take a few moments.

How long are we talking on average?

rover

3:49 pm on Apr 4, 2005 (gmt 0)

10+ Year Member



Thanks. Most are very quick, its just some that will take 20 - 30 seconds before the result is displayed. I suppose I could do something with javascript also. I was just wondering if there might be an easy way to do this with PHP that I was overlooking.

killroy

4:29 pm on Apr 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have to disable output buffering, or force the buffers to flush.

SN

jusdrum

7:39 pm on Apr 4, 2005 (gmt 0)

10+ Year Member



If using javascript isn't an issue, you may want to look into XMLHTTPRequest to make the call to the page in the background. Make the default content of a container div something like "processing...", then make your javascript function take the output from your XMLHTTPRequest call and populate the container div.

rover

2:56 pm on Apr 5, 2005 (gmt 0)

10+ Year Member



Thanks very much, I appreciate it. I think I can do this by flushing the buffers, and I'll also check out the XMLHTTPRequest method.