SA-MP Forums Archive
Total Registered Players - MYSQL - 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: Total Registered Players - MYSQL (/showthread.php?tid=341737)



Total Registered Players - MYSQL - nGen.SoNNy - 11.05.2012

Hi! Can somebody tell me a function in mysql which can count the number of players from the database? +REP


Re: Total Registered Players - MYSQL - Fj0rtizFredde - 11.05.2012

You could use COUNT() Like this:
PHP Code:
SELECT COUNT(*) FROM accounts 
I think you also can use "mysql_num_rows" and do something like this:
pawn Code:
mysql_query("SELECT * FROM accounts");
mysql_store_result();
new rows = mysql_num_rows();
mysql_free_result();
 
printf("There are %d accounts",rows);



Re: Total Registered Players - MYSQL - Kar - 12.05.2012

pawn Code:
mysql_query("SELECT COUNT(`Username`) FROM Accounts");
Wouldn't this be better in terms of speed.


Re: Total Registered Players - MYSQL - nGen.SoNNy - 12.05.2012

Thx


Re: Total Registered Players - MYSQL - nGen.SoNNy - 12.05.2012

This works better

PHP Code:
SELECT COUNT(*) FROM accounts 



Re: Total Registered Players - MYSQL - dEcooR - 24.07.2013

Can somebody tell me how to make it in normal example in Y_INI?


Re: Total Registered Players - MYSQL - x96664 - 28.09.2013

I know that I'm bumping an old topic, but how will this work for R33 plugin ?