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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mwalls
Forum Newbie
Posts: 1
Joined: Tue Feb 25, 2003 2:07 pm

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

Post 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?
kcomer
Forum Contributor
Posts: 108
Joined: Tue Aug 27, 2002 8:50 am

Post 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
decoy1
Forum Commoner
Posts: 50
Joined: Fri Feb 21, 2003 1:33 pm
Location: St. Louis

Post 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.
hurkle
Forum Newbie
Posts: 15
Joined: Tue Feb 11, 2003 1:21 pm
Location: Minnesota, USA

Post 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.
Post Reply