How can I collect?
#1

Hello,

I want to collect lines on MySQL so I used "MySQL_Count" fuction but I had a problem with it.

On the pop-up screen, I got "undefined symbol "MySQL_Count" alert.

Does anyone have an idea, how I can fix this problem?
Reply
#2

You could just use mysql_num_rows() and store it with mysql_store_result().
Reply
#3

Easy, I assume you want to could all registered players on the server from the database?

This is what I did:

[pwano]
CMD:registeredplayers(playerid, params[]) {
mysql_query("SELECT * FROM `accounts`");
mysql_store_result();
new string[128];
format(string, sizeof(string), "[SERVER]: There are currently %d currently registered players.", mysql_num_rows());
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
mysql_free_result();
return 1;
}
[/pawno]

* means ALL

samething can be done for total houses, total businesses, total tickets, etc.
Reply
#4

use SELECT COUNT
Reply
#5

Quote:
Originally Posted by Mark_Weston
Посмотреть сообщение
Easy, I assume you want to could all registered players on the server from the database?

This is what I did:

[pwano]
CMD:registeredplayers(playerid, params[]) {
mysql_query("SELECT * FROM `accounts`");
mysql_store_result();
new string[128];
format(string, sizeof(string), "[SERVER]: There are currently %d currently registered players.", mysql_num_rows());
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
mysql_free_result();
return 1;
}
[/pawno]

* means ALL

samething can be done for total houses, total businesses, total tickets, etc.
Thank a lot. İt's works!
Reply
#6

Quote:
Originally Posted by KingHual
Посмотреть сообщение
use SELECT COUNT
This. There are usually multiple ways to get to the result, but they are not all equally efficient. Selecting a single number is obviously going to be much faster than loading an entire result into memory.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)