Search
Left Quote    Knowledge speaks, but wisdom listens.
- Jimi Hendrix    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: sleep() than echo
  This user is offline  David1159
  Subject: "sleep() than echo" Posted: @ 8:31 pm on Mar 12 2008   

Member #: 526
Rank: User - (81)
Since: 12/27/07
Posts: 81
From: usa

I really need some help. It worked on my test webhost, now not on my current webhost. This is how users enter my site, a joke is said, with delays, to the punch lines. 1000 visitors my first day open too, and now on the 3rd, this is really hurting my site right now.

I can't get this to work for the life of me. I am trying to have them click a button, than a automated message to appear with delays between messages. It works 1 out 3 times in Firefox usually, and doesn't in IE at all. Most of my users use IE.

Now I figured flush() would work or setting the time to 0, but it doesn't. I think I am timing out the browsers.

I need a 10 sec wait, than a 20 sec wait. It needs to be in the same execution though.

Thank you all in advance!

Heres the code, simplified down.


Code:
<form enctype="m ultipart/form-d ata" method="po st" name="entr ance">< br /> <input type="subm it" name="clic k" value="ENT ER">
</form>
<?
if(isset($_POST ["click&qu ot;])) {

echo ' PART 1';
sleep(10);
flush();
set_time_limit( 0 );


echo ' <P> PART 2';
sleep(20);
flush();
set_time_limit( 0 );

}
?>




Coding is simply CST... Combining $hit Together. We make different $hit to run in unison correctly.
    Viewed: 3,616 Times | Reply to This | To top
  This user is offline  misterhaan
  Subject: "re: sleep() than echo" Posted: @ 3:20 pm on Mar 13 2008    

Member #: 5
Rank: User - (213)
Since: 02/11/05
Posts: 148
From: chair

ie usually waits until it's received the entire page before it starts to render it (meaning your sleep()s just make the site seem slower).

the most reliable way to do this is with javascript: look up the setTimeout() function. i'd remove the sleeps and send up the delayed content with css display set to none, then use the javascript to set the display to "" (this makes it use the default display for the element).




please note that the above post is likely made up in its entirety.

    Viewed: 3,601 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank