Page 1 of 1

help with a "please wait ... loading" graphic or t

Posted: Tue Feb 25, 2003 2:07 pm
by mwalls
Hi, I am hitting a database and have the potential for a very large found set resulting in a very large page that may take a while to load. Is there a way to create an intermediary "please wait ... loading" image that can be shown on a page while it loads rather than just having to wait on a blank screen?

Posted: Tue Feb 25, 2003 2:47 pm
by kcomer
You could use the output control functions php has. Some browsers are picky baout what they will show before the whole page loads but I have had some good luck with it.

Keith

Posted: Tue Feb 25, 2003 4:29 pm
by decoy1
You might think about breaking the result set up into X amount of data per page with the option to 'continue' on each page. Just like this message board...25 or so posts are shown per page.

Not only is waiting a long time for pages to load very annoying, it is also an unnecessary waste of bandwidth. Causing a serious bottleneck (think of multiple persons doing simultaneous queries), and money.

Posted: Tue Feb 25, 2003 6:16 pm
by hurkle
I agree with the above, the best thing to do is try not to send huge results. That having been said, there are times when you just plain have to. Heres what I do in that situation..

Code: Select all

echo "<IMAGE src='loading.gif' style = ' position:absolute; top:50px;";
echo "left: 50px;' width = '320' height = '240'>";

//output 9 gazillion rows from your database...

//and after all that..

echo "<IMAGE src='complete.gif' style = ' position:absolute; top:50px;";
echo "left: 50px;' width = '320' height = '240'>";
A few things to keep in mind.. I don't think this will work if you're buffering your output ( ob_start() ).
You'll want to change the image names to whatever you have, ditto the width and height values, and modify the px values to place the image in the right spot.

Basically this is using CSS inline style tag to slap an image in an exact spot, display the rest of your output, then slap a different image in exactly the same spot. the last displayed goes on top.

I use this a lot, works slick, and it's all server side, no javascript required.

Hope this helps.