Hi,
How do you get it to say "Page Loading... Please be Patient" while the information from your database is being loaded, and once it is completed the statement disappears?
Any help would be appreciated...
Thanks,
Doug
| SitePoint Sponsor |



Hi,
How do you get it to say "Page Loading... Please be Patient" while the information from your database is being loaded, and once it is completed the statement disappears?
Any help would be appreciated...
Thanks,
Doug





Which web server are you using?



Unix
Unix is an Operating System (like Windows) the webserver is probably Apache
Sean![]()
Harry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature



ApacheSorry...





Back again (I was reading another thread), there's an option in Apache web server where you can send the content to the client (ie the visitor's browser) in pieces instead the whole page. Let me look at the manual, and I'll post it here.





Ok, there's a function, flush(), quoting PHP manual,
This function only works in UNIX OS (well that's in theory because I only have Win 98, soon I'm going to install Mandrake but that's another history..). So having this in mind why don't you try this script:Flushes the output buffers of PHP and whatever backend PHP is using (CGI, a web server, etc.) This effectively tries to push all the output so far to the user's browser.
I think that doesn't work with all the browsers, and depends on your html code. Try it and tell us what happen.PHP Code:<?
echo "Page Loading... Please be Patient";
flush();
... MYSQL stuff here ....
... working ....
... finish mySQL checking ...
echo "Process finished, Thanks for waiting";
flush();
?>



Is this where I would put it?
<?
echo "Page Loading... Please be Patient";
flush();
mysql_connect("localhost","xxxxxxxx","xxxxxxx");
mysql_select_db("thedatabase");
$query = "SELECT * FROM my_domains WHERE priceb >= 99 ORDER BY name";
$result = mysql_query($query);
echo "<html><body bgcolor=\"#FFFFFF\"><table border=\"0\" align=\"center\" width=\"600\" cellspacing=\"0\" cellpadding=\"2\"><tr><td><b>Domain</b></td><td><b>Price</b></td></tr>";
while($row = mysql_fetch_array($result))
{
$price = $row['priceb'];
$domain = $row['name'];
echo "<tr><td>$domain</td><td>$price</td><td><a href=\"mailto:$domain@mywebsite.com?subject=$domain\">Contact Us</a></td></tr>";
}
echo "Process finished, Thanks for waiting";
flush();
?>
</table>
</body>
</html>





Seems Ok. Have you try it?



I have tried it a bunch of different ways...
I can get the Page Loading to come up, but it won't go away when the page is loaded. I must be doing something wrong.
Anybody out there know what I am missing???
Thanks for all your help Paul...
Doug





Try if this script works,
You're going to see the first line, and then after 10 seconds the other line must appear.PHP Code:<?php
echo "Page Loading... Please be Patient";
flush();
sleep(10);
echo "Process finished, Thanks for waiting";
flush();
?>



It does that... but the "Page Loading" text never goes away. What I was hoping it would do is blink "Page Loading" and then just disappear all together when it is loaded. I know I have seen that on many sites. I just can't find one right now of course...
Thanks,
Doug





Ok a final shot,
BTW do you know which version of PHP are you using?PHP Code:<?php
print ("Page Loading... Please be Patient");
flush();
sleep(10);
print("Process finished, Thanks for waiting");
flush();
?>
well, OF COURSE the "Page Loading..." thing is going to stay there! why wouldn't it? you echoed it to the browser, so why would the browser hide it? the only way you'd be able to hide it is if you used some dynamic HTML. have it do something to hide the message once the bottom of your page loads.
EDIT: oh, Doug, when you see that on other sites, they're just using a refresh META tag to go to another page. it's not the same page w/ the message disappearing. you're talking about like when you do a search on these forums and it says "search in progress," right? yep, they're just redirecting the browser after a few seconds.
i've wanted to do this too, but there's no good way that i've found.![]()
Last edited by DR_LaRRY_PEpPeR; Oct 6, 2001 at 19:52.
- Matt
Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
"Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR





or it could be using flash.
people use flash preloaders to preload the content and display a loading screen while it's loading.
also, i "believe" javascript can do something like that.





as Defender mentions... you could stick your message in a <div id="hangon">....</div> etc
and then send a javascript with the second flush() to hide the div...
echo "<script>document[hangon].style.visibility=hidden</script>";
- not sure about the javascript reference to the div there but you get the idea.

You can do this using DHTML
here is the code for it:
<!-- Put this code inside of your <HEAD> tag. -->
<style type="text/css">
#divLoadCont {
position: absolute;
width: 100%;
height: 98%;
top: 0;
left: 0;
background-color: white;
layer-background-color: white;
font-family: arial,helvetica;
z-index: 100;
}
</style>
<script type="text/javascript" language="JavaScript">
function ccbrowsercheck(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new ccbrowsercheck()
function cchidediv(div){
if(bw.bw){
div="divLoadCont"
obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?document[div]:0;
obj.visibility='hidden'
}
}
onload=cchidediv;
</script>
<!-- Put this code inside of your <BODY> tag. Make sure it is ABOVE all other body content. -->
<script>
if(bw.bw)
document.write('
<div id="divLoadCont">
<table width="100%" height="95%" align="center" valign="middle">
<tr>
<td width="100%" height="100%" align="center" valign="middle">
<h3>Loading Page....</h3>
</td>
</tr>
</table>
</div>
')
</script>
hope it help you!![]()



Do I need to put any onLoad code in the Body tag?
Thanks,
Doug
Bookmarks