RE: online/offline...but on a list of users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> <clip>
> > 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?
> </clip>
>

> 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.
>

> --------------------------------------------
>

> Thanks! Thats a really good idea and one that i didnt think of.
>

> For now it should be okay as there are just a few hundred users, but
> if it gets really big then it might be a bit of a problem...
> if you any other ideas please feel free to reply till then

> I'll try your
> idea out.
>


What about using the 'in' or 'exists' keyword in sql.

for example:
select * from (select username from <the rest of your online select
statement>) a
where a.username in ($username, $username, $username ..)

Use some for loop to build up your 'in' statement.

A better way to do it is using joins and the exists statement, but its too
early for that. :)


************************

This message has been delivered to the Internet by the Revenue Internet e-mail service

*************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux