A not working command -
x96664 - 27.09.2013
Any ideas why it shows me 0 when the accounts are not 0 ?
pawn Код:
CMD:accounts(playerid, params[])
{
new query[128], string[128];
format(query, sizeof(query), "SELECT COUNT(`ID`) FROM `players`");
mysql_function_query(IMDb, query, false, "", "");
format(string, sizeof(string),"» Total accounts: %i «", mysql_num_rows());
SendClientMessage(playerid, -1, string);
return 1;
}
Re: A not working command -
Ayumi - 27.09.2013
What are you exactly trying to accomplish here?
Be specific as what you're doing could be affiliated with a lot of things.
Re: A not working command -
x96664 - 27.09.2013
Im trying to make a command which shows the amount of all registered accounts on my server and also I ran the code in phpmyadmin and it returns the right number.
Re: A not working command -
SuperViper - 28.09.2013
That's not how you use threaded queries.
pawn Код:
forward public CallbackName(playerid);
public CallbackName(playerid)
{
new rowCount, fieldCount;
cache_get_data(rowCount, fieldCount, IMDb);
format(string, sizeof(string),"» Total accounts: %i «", rowCount);
SendClientMessage(playerid, -1, string);
return 1;
}
mysql_function_query(IMDb, query, true, "CallbackName", "i", playerid);
Re: A not working command -
x96664 - 28.09.2013
Quote:
Originally Posted by SuperViper
That's not how you use threaded queries.
pawn Код:
forward public CallbackName(playerid);
public CallbackName(playerid) { new rowCount, fieldCount; cache_get_data(rowCount, fieldCount, IMDb);
format(string, sizeof(string),"» Total accounts: %i «", rowCount); SendClientMessage(playerid, -1, string); return 1; }
mysql_function_query(IMDb, query, true, "CallbackName", "i", playerid);
|
I can't get why I should use threaded query to count the registered accounts and my problem was that it shows 0 accounts, when they were 285 also when I executed the code in phpmyadmin it showed me 285.
Re: A not working command -
Sweez - 28.09.2013
Nice mappings :0
Re: A not working command -
x96664 - 28.09.2013
Quote:
Originally Posted by Sweez
Nice mappings :0
|
Thanks, but this thread is not about the maps
Re: A not working command -
x96664 - 29.09.2013
Quote:
Originally Posted by x96664
Any ideas why it shows me 0 when the accounts are not 0 ?
pawn Код:
CMD:accounts(playerid, params[]) { new query[128], string[128]; format(query, sizeof(query), "SELECT COUNT(`ID`) FROM `players`"); mysql_function_query(IMDb, query, false, "", ""); format(string, sizeof(string),"» Total accounts: %i «", mysql_num_rows()); SendClientMessage(playerid, -1, string); return 1; }
|
Bump.
Re: A not working command -
Konstantinos - 29.09.2013
Quote:
Originally Posted by x96664
Bump.
|
Why are you bumping when SuperViper has already given an answer to your problem?
Re: A not working command -
x96664 - 29.09.2013
Quote:
Originally Posted by Konstantinos
Why are you bumping when SuperViper has already given an answer to your problem?
|
Because that code messed up with my server things and when I logged and spawned I died and commands weren't working.