12.05.2013, 23:06
You forgot to store and free the result, therefore mysql_num_rows returned -1 because no result was stored and the function couldn't retrieve any data.
Try this instead:
Try this instead:
pawn Код:
CMD:checkregistered(playerid,params[])
{
new totalreg;
mysql_query("SELECT COUNT(*) FROM accounts");
mysql_store_result(); // IMPORTANT
totalreg = mysql_num_rows();
mysql_free_result();
format(str,sizeof(str),"%d has registered on the server.",totalreg);
SCM(playerid,lightgreen,str);
return 1;
}