RE: [PHP] Showing online users!
| From: | John Holmes | Date: | Wed, 25 Sep 2002 04:02:53 +0000 |
| Subject: | RE: [PHP] Showing online users! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117497@lists.php.net to get a copy of this message | ||
How about:
SELECT sUser FROM members WHERE sUpdated > NOW() - INTERVAL 10 MINUTE;
as your query... I assume you are using a MySQL format
date/datetime/timestamp column for sUpdated?
---John Holmes...
> -----Original Message-----
> From: Philip J. Newman [mailto:newmanpj@philipnz.com]
> Sent: Tuesday, September 24, 2002 11:48 PM
> To: php-general@lists.php.net
> Subject: [PHP] Showing online users!
>
> The best way to show online users ...
>
> every page that is loaded while a user is online the time stamp is
updated
> in there profile
>
> <?
>
> $sql = "SELECT sUser FROM members WHERE sUpdated >
> from_unixtime(unix_timestamp(now())-(10*60))";
> $sql_result = mysql_query($sql, $connection) or die (mysql_error());
>
> while ($row = mysql_fetch_array($sql_result)) {
> $sUser=$row["sUser"];
>
> echo"<b><a
>
href=\"/actual/thesite.php?startWeb=profile&sUser=$sUser\">$sUser</a></b
>,
> ";
>
> }
>
> ?>
>
> Is this the best way to do this?
>
> ---
> Philip J. Newman.
> Head Developer.
> PhilipNZ.com New Zealand Ltd.
> http://www.philipnz.com/
> info@philipnz.com
>
> Mob: +64 (25) 6144012.
> Tele: +64 (9) 5769491.
>
> Family Site:
> Philip J. Newman
> Internet Developer
> http://www.newman.net.nz/
> info@newman.net.nz
>
> *****************************
> Friends are like Stars,
> You can't always see them,
> But you know they are there.
>
> *****************************
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php