Ryan A wrote:
<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.

Thanks,
Ryan





One of the things to think about with this is, although you may have a few hundred users signed up how many are "online" at once. I've got a forum with a few thousand members, but at any one time there's only about 15 average that are "online". It peaks at about 45 sometimes, but that's rare. So the array in this case is relativly small. Plus it lets you do other things with the infomation like "There are X users online", showing who is reading what and stuff like that.

If your running a site like MySpace or DA then it could be a problem. They tend to break things down though into smaller groups like showing your "friends", or whatever they call them, that are "online".

Another idea that goes with what Chris had said is to use a join on your "online" table. I'm assuming that your having to do a lookup for each post in the forum anyway, just join the "online" table here against the members id or name or whatever your using to track who makes the individual posts. How you do it exactly really depends on how you're building up the forums page.

That would probably be a better situation all around if you're doing a query for each post anyway.

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

Reply via email to