You can have your script enter a loop to check for data in a database.
If data output it then calls the flush() function to output to the browser.
Then sleep for some time, then wakeup and repeat. You may have issues
with some browsers using this technique, but generally it does work.
The key is that you never close the connection to the browser. You'll
also want to occasionally output some invisible content, otherwise the
connection_status() stuff never give the right value (at least not in
4.1.2) It struck me that these functions update their flags on output
only. Which means you need to output something to the browser to detect
that the user has hit stop, or has disconnected.


Oliver Witt wrote:
> I attempted to write a oage that you can chat on with php. It ended up
> being a page that reloads itself all the time which isn't really what I
> wanted. But I didn't know how to do it differently. Is there another
> way? I heard something about flush()?
> Kind regards,

| Robert Cummings |
| Webdeployer - Chief PHP and Java Programmer  |
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109                 |
| Website :           |
| Fax     : (613) 260-9545                     |

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to