|
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.
Navigation:
[Reply to this message]
|