Re: Re: new data detect
| From: | Hugh Bothwell | Date: | Thu, 26 Jul 2001 03:06:54 +0000 |
| Subject: | Re: Re: new data detect | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10784@lists.php.net to get a copy of this message | ||
From: "Sommai Fongnamthip" <sommai@thaithanakit.co.th>
To: "Hugh Bothwell" <hugh_bothwell@hotmail.com>; <php-db@lists.php.net>
Sent: Wednesday, July 25, 2001 10:37 PM
Subject: Re: [PHP-DB] Re: new data detect
>
> At 22:28 25/7/2001 -0400, Hugh Bothwell wrote:
>
> >"Sommai Fongnamthip" <sommai@thaithanakit.co.th> wrote in message
>
> >>news:5.1.0.14.2.20010726085848.00a7f760@langsuan.thaithanakit.co.th...
> > > Hi,
> > > I decide to make real time application (like stock market or online
> > > news). How could I know when new data arrive to table and retrieve
them
> >to
> > > display or update in web page?
> >
> >You can't, actually, short of using server-side push;
> >
> >what you can do is periodically requery the server; either reload the
page
> >every so often, or (better) use a flag file - set it when data is
changed -
> >and check it in the background with JavaScript, then reload the page only
> >when it is set.
>
> Why PHP cannot do background check with the same of Java Script?
Because:
(a) JavaScript runs on the client, so it can periodically call the server;
PHP runs on the server, has no way to contact the client (short of
server-side push ie a continuous connection).
(b) JavaScript can run continuously (by setting a timer); PHP only runs when
called.