Reply to Re: [PHP] online/offline...but on a list of users

Your name:

Reply:


Posted by Edward Vermillion on 09/05/05 05:28

Ryan A wrote:
> Hi,
> I have a profiles page where next to the username I have a icon that says
> "Online" or "Offline" if the
> persons whose profile you are browsing signed in or clicked anything in the
> last 3 minutes (I am also
> using a meta refresh to call a script every 2 1/2 mins)
> this is how i am doing it:
>
> $check_if_member_online="select NOW() < DATE_ADD( last_online, INTERVAL 3
> MINUTE ) as j_is_online FROM `".$prefix."members_online` WHERE cno
> ='".$jno."' and member_name='".$username."' LIMIT 1";
>
> This is the table it calls
> _members_online (
> cno bigint(20) NOT NULL default '0',
> member_name varchar(30) default NULL,
> last_online datetime default NULL,
> KEY member_name (member_name),
> KEY cno (cno),
> )
>
> and its working fine.
>
> I want to add this same functionality to a forum on the same site (the forum
> was custom programmed
> from scratch and not any of the popular ones), but since in a single thread
> there can be a lot of different
> people/usernames that answer I would prefer _not_ to do a select lookup for
> each username...
> any ideas on how else it can be done?
>
> Thanks,
> Ryan
>

I'd say start with a query that pulls the online users into an array,
then do an array_key_exists() or in_array() against that.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация