LCKB
[PHP] Get a list of online characters - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: [PHP] Get a list of online characters (/showthread.php?tid=2317)



- Paramount - 08-17-2013


Hey! I am interested how to get a list of online chars, well, I tried to look into the online count script, but it uses t_user table, just for count. Have you got any idea bout it?

 

Thanks in advance!




- Sutz - 08-17-2013


Im not really sure :?

 

The only way I know of atm is from t_users but thats for accounts an wont support single chars




- Wizatek - 08-17-2013


A dirty way to get this would be

 

SELECT a_nick, a_user_index
FROM newproject_db.t_characters c
WHERE a_user_index IN
(
SELECT a_portal_index
FROM newproject_auth.t_users
WHERE a_zone_num != -1
)
AND a_index =
(
SELECT a_index
FROM newproject_db.t_characters
WHERE a_user_index = c.a_user_index
ORDER BY a_datestamp DESC
LIMIT 1
)
GROUP BY a_user_index
But its not really efficient and if u would use this query live and not cachedthen someone could harm your mysql server spam loading this page




- Paramount - 08-17-2013


Oh thanks guyz! This page would be closed, and will be just for me.

 

Thanks again Wink




- Sutz - 08-17-2013

Hmm that script just blown my mind lol.




- Johnny5 - 08-17-2013

Topic Closed by a moderator. The reason why: Solved, thanks to MaX and Wizatek for help.