[HELP] Online users

Status
Not open for further replies.

Monkey

Member
Apr 7, 2012
114
16
Hey, this is really nooby but I'm developing a CMS and as I'm new to it I was wondering how to display the online users.

Such as on Rev you do {online}.

Is it possible if someone told me how he did it?
 

XenPHP

New Member
Apr 13, 2012
16
1
Well, if you're using phoenix emulator, it's quite simple. Just simple use mysql_result and all should be well. Here, I'll do it for you.
PHP:
$q = mysql_query("SELECT online_users FROM server_status LIMIT 1");
mysql_result($q, 0);

Here is how it works. Firstly, the line where it says $q = mysql_query(....); isn't really needed. It's just to make the code look more clean. You can simply do:
PHP:
mysql_result(mysql_query("SELECT online_users FROM server_status LIMIT 1") , 0);

That will have the same output as the above. Supposing you know how the mysql_query function works, and you're already connect to a database, the mysql_result functions basically fetches the result of the query. The zero basically means the first result, incase there was more then one result.
 
Status
Not open for further replies.

Users who are viewing this thread

Top