Re: [PHP] sleep function

2005-05-13 Thread Richard Lynch
On Thu, May 12, 2005 8:38 pm, James Williams said:
 I just tried a couple of output_buffering on a test script I made and
 it won't work... It simply waits for 10 seconds then displays
 everything...  Kinda sucks.

If you're going to flush() and ob_flush() that much, you might as well not
use ob_start or output buffering at all.

Rip out all the ob_* stuff and see if it works under Windoze.

PS The one I looked at on your site worked just fine...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sleep function

2005-05-13 Thread Mark Rees
You could try sending all the data to the client at once then achieving
the delay effect with JavaScript perhaps? That way, you are not reliant
on external factors like connection speed.

On Thu, May 12, 2005 8:38 pm, James Williams said:
 I just tried a couple of output_buffering on a test script I made and 
 it won't work... It simply waits for 10 seconds then displays 
 everything...  Kinda sucks.

If you're going to flush() and ob_flush() that much, you might as well
not use ob_start or output buffering at all.

Rip out all the ob_* stuff and see if it works under Windoze.

PS The one I looked at on your site worked just fine...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

EOE

**
**


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-13 Thread James Williams
Well the reason it worked on my site is because my webhost uses linux,
and my localhost is windows.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread Philip Hallstrom
Hi,
I want to create a script that displays all names from a database once per 
second.
A part of the script look like this.
for ($i=0; $i$total_names; $i++)
   {
 echo namebr;
 sleep (1);
   }
The scipt works fine but it displays all names at once. I want to display the 
first name, then refresh the browser and display the first name and the second, 
then the first name, the second and the third and so on.
Can someone please tell me how can i do this?
Right before your sleep(1) function add:
flush();
This should do it.  Depends on how your webserver buffers things and if 
there's any proxy servers, etc. in the way.

-philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sleep function

2005-05-12 Thread James Williams
On 5/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,
 
 I want to create a script that displays all names from a database once per 
 second.
 A part of the script look like this.
 
 for ($i=0; $i$total_names; $i++)
 {
   echo namebr;
   sleep (1);
 }
 
 The scipt works fine but it displays all names at once. I want to display the 
 first name, then refresh the browser and display the first name and the 
 second, then the first name, the second and the third and so on.
 Can someone please tell me how can i do this?
 
 Thanks in advance for your help !!!
 
 
You're gonna have to use output buffering... I have never used it so
I'm no expert, but I figured I could point you in the right direction.
http://ca3.php.net/outcontrol

-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread Richard Lynch
On Thu, May 12, 2005 12:39 pm, [EMAIL PROTECTED] said:
 I want to create a script that displays all names from a database once per
 second.
 A part of the script look like this.

 for ($i=0; $i$total_names; $i++)
 {
   echo namebr;

http://php.net/flush

   sleep (1);
 }

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread James Williams
I just tried a couple of output_buffering on a test script I made and
it won't work... It simply waits for 10 seconds then displays
everything...  Kinda sucks.

On 5/12/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Thu, May 12, 2005 12:39 pm, [EMAIL PROTECTED] said:
  I want to create a script that displays all names from a database once per
  second.
  A part of the script look like this.
 
  for ($i=0; $i$total_names; $i++)
  {
echo namebr;
 
 http://php.net/flush
 
sleep (1);
  }
 
 --
 Like Music?
 http://l-i-e.com/artists.htm
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sleep function

2005-05-12 Thread James Williams
Okay... the difference is between Apache + PHP for windows, and Apache
+ PHP for unix... it works on linux / unix... but not on windows...
check it out.

http://www.jamwil.com/misc/flush.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sleep Function

2003-11-03 Thread Marek Kilimajer
It is exactly what you need. And you can lower the sleep time, I think 1 
or 2 seconds are just enough.

Glenn Gasner wrote:
The php.net documentation for the sleep and usleep functions has me
confused.  I'm using shared hosting and I need to email my whole mailing
list while not clogging the shared mail server.  What I'm trying to do is
put a pause between each email sent (like 10 seconds) so I can set it up to
send a thousand (or whatever) messages without manually putting time between
batches.  My guess is that I should put a line with sleep(10); inside the
mail sending loop so that it pauses between notes.  However, the Jan-17 note
on the usleep function mentions that these kinds of loops can consume 100%
of CPU while running.  The Jan-29 note on the time() function says that
sleep uses way less CPU than wait(). I don't know how to test CPU usage of
any PHP function.  Is sleep() really so CPU intensive that I should avoid
it, is there a better function to use, or is it exactly what I need and
it'll be no problem even on a shared server?
Thanks!
Glenn Gasner
glenn at perex dot com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] sleep() function question

2001-07-23 Thread Patrick Lynch

Is 
output_buffering = On
set in the php.ini file?

If it is set to on, no content or headers are sent back to the browser until
the whole page has been processed by PHP.

Best Regards,
Patrick Lynch.  

Eirco
Web: http://www.eirco.com


-Original Message-
From: Andrew Brampton [mailto:[EMAIL PROTECTED]] 
Sent: 23 July 2001 02:38
To: drb
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] sleep() function question


I know very little about PHP, but in other languages, what u describe
happens because the webserver doesn't send the output until the excution is
done...

But you can make it write your output as its generated... check out the
function flush

also after 20seconds of looking, I found ob_implicit_flush that may help
as well..

Hope I could help
Andrew
- Original Message -
From: drb [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, July 22, 2001 11:25 PM
Subject: [PHP] sleep() function question


 just wanted to make sure I was not doing anything incorrectly.

 I want to return some values to the screen and then sleep(), then
 return more values. It seems that nothing is returned till the sleep 
 is over and then all the values are returned at once.

 Is this the natural function of sleep();

 thanks,

 DRB



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] To
 contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To contact
the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] sleep() function question

2001-07-22 Thread Andrew Brampton

I know very little about PHP, but in other languages, what u describe
happens because the webserver doesn't send the output until the excution is
done...

But you can make it write your output as its generated... check out the
function flush

also after 20seconds of looking, I found ob_implicit_flush that may help
as well..

Hope I could help
Andrew
- Original Message -
From: drb [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, July 22, 2001 11:25 PM
Subject: [PHP] sleep() function question


 just wanted to make sure I was not doing anything incorrectly.

 I want to return some values to the screen and then sleep(), then return
 more values.
 It seems that nothing is returned till the sleep is over and then all the
 values are returned at once.

 Is this the natural function of sleep();

 thanks,

 DRB



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]