SA-MP Forums Archive
Registered 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: Registered players (/showthread.php?tid=625809)



Registered players - Loinal - 06.01.2017

PHP код:
mysql_query(connectionHandle,"SELECT * FROM players");
mysql_store_result();
new 
rows mysql_num_rows();
mysql_free_result();
printf("There are %d accounts",rows); 
Server_Logs:

Код:
[21:53:49] [join] [LC]Martex has joined the server (0:127.0.0.1)
[21:54:22] New account registered. ID: 5
[21:54:22] There are 0 accounts
[21:54:31] [part] [LC]Martex has left the server (0:1)



Re: Registered players - Yaa - 06.01.2017

PHP код:
mysql_query(connectionHandle,"SELECT * FROM players"); 
mysql_store_result(); 
new 
rows mysql_num_rows(); 
printf("There are %d accounts",rows);  
mysql_free_result(); 



Re: Registered players - iLearner - 06.01.2017

Try:
Quote:

mysql_query(connectionHandle,"SELECT * FROM players WHERE 1");




Re: Registered players - itsCody - 06.01.2017

pretty sure it's something like

PHP код:
mysql_query(connectionHandle,"SELECT COUNT(*) FROM players"); 
or something along the lines


Re: Registered players - Loinal - 06.01.2017

Still get only 0


Re: Registered players - saffierr - 06.01.2017

I know how, Wait til I'm back home, I'll either PM you or reply to this topic.


Re: Registered players - saffierr - 07.01.2017

Here you go:
PHP код:
new, var;
mysql_query(connectionHandle"SELECT `ID` FROM `players`");
var = 
cache_get_row_count();
printf("There are %i accounts", var); 
Tell me if it worked.


Re: Registered players - NaS - 07.01.2017

Quote:
Originally Posted by Yaa
Посмотреть сообщение
PHP код:
mysql_query(connectionHandle,"SELECT * FROM players"); 
mysql_store_result(); 
new 
rows mysql_num_rows(); 
printf("There are %d accounts",rows);  
mysql_free_result(); 
What are you even trying here? Changing that line will make exactly ZERO difference.


The query is correct. All of you who tried to fix it: You should probably take another MySQL lesson. Damn..

It's something else we cannot tell you without more info (database layout, MySQL Plugin Version, correct database selected?, etc).
Depending on the version you use you must also make sure to enable caching for that query (look at the parameters) otherwise the result cannot be saved.

Also enable logging and see the MySQL log. If something doesn't work that should be the first thing to do!
It's even telling you if the query is correct, or not...


Re: Registered players - saffierr - 07.01.2017

Don't worry mate, My code works for me.


Re: Registered players - Loinal - 07.01.2017

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Here you go:
PHP код:
new, var;
mysql_query(connectionHandle"SELECT `ID` FROM `players`");
var = 
cache_get_row_count();
printf("There are %i accounts", var); 
Tell me if it worked.
Код:
[12:28:27] [join] YouBoy has joined the server (0:127.0.0.1)
[12:28:41] New account registered. ID: 9
[12:28:41] There are 0 accounts
[12:28:46] [part] YouBoy has left the server (0:1)