Finding out the amount of Registered/Banned players
#1

Hey,

I was wondering how I can find out the amount of Registered/Banned players, so I can implement it into my server info dialog. I use MySQL R33. Also, is it possible to find out the amount of Admins?

Thanks,

FunnyBear
Reply
#2

amount of admin i don't know
but amount of all records/rows in a table can be counted by using : mysql_num_rows (actually for your version)
Reply
#3

Код:
select count(`field`) from `table`
for admins / banned players something like
Код:
select count(`id / or name`) from `table` where `auth_level` != '0'
Reply
#4

Quote:
Originally Posted by Djole1337
Посмотреть сообщение
Код:
select count(`field`) from `table`
Could you explain abit more?
Reply
#5

I'm still a little confused.
Reply
#6

In PHP you can do something like this:

PHP код:
$handle = new mysqli('localhost','root','pass','db');
    
    
$sql "SELECT count(id) AS rows FROM table;";
    
$result $handle->query($sql);
    
$rows mysqli_fetch_row($result);
    
    echo 
$rows[0]; 
You can now handle it into pawn using cache.
Reply
#7

Alternatively, you can simply launch a SELECT query and then in the callback use mysql_num_rows to get the amount. It is basically the same thing I suppose, how-ever I haven't used the "SELECT count" function(ever).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)