SA-MP Forums Archive
Finding out the amount of Registered/Banned players - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Finding out the amount of Registered/Banned players (/showthread.php?tid=564127)



Finding out the amount of Registered/Banned players - FunnyBear - 19.02.2015

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


Re: Finding out the amount of Registered/Banned players - amirab - 19.02.2015

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)


Re: Finding out the amount of Registered/Banned players - Djole1337 - 19.02.2015

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



Re: Finding out the amount of Registered/Banned players - FunnyBear - 19.02.2015

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


Re: Finding out the amount of Registered/Banned players - FunnyBear - 19.02.2015

I'm still a little confused.


Re: Finding out the amount of Registered/Banned players - arakuta - 19.02.2015

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.


Re: Finding out the amount of Registered/Banned players - Abagail - 19.02.2015

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