Registered players
#1

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)
Reply
#2

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

Try:
Quote:

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

Reply
#4

pretty sure it's something like

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

Still get only 0
Reply
#6

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

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.
Reply
#8

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...
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)