homepage Welcome to WebmasterWorld Guest from 54.166.84.82
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Php Sleep Function
The sleep function does not work as I expect
cayetanob

5+ Year Member



 
Msg#: 3619483 posted 8:58 pm on Apr 4, 2008 (gmt 0)

Hi,

I have a list of users and I want to display each one ONE SECOND after the last.

So I use the sleep() function, and what happend is, that it sleep the total amount of all records and then displays all of them of a sudden.

Ej. If I have 20 users, the sistem last 20 seconds and show all of them suddenly, no one by one.

regards
cayetano

 

cameraman

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3619483 posted 9:05 pm on Apr 4, 2008 (gmt 0)

PHP doesn't send anything to the browser until the script has completed its execution. You'd have to use a browser-side script like Javascript to do what you want.

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3619483 posted 7:27 pm on Apr 5, 2008 (gmt 0)

or you can flush [php.net] the information upon each iteration after the sleep().

cayetanob

5+ Year Member



 
Msg#: 3619483 posted 11:13 pm on Apr 7, 2008 (gmt 0)


Thank you coopster, the flush() worked fine.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved