/checkregistered
#7

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:

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;
}
Reply


Messages In This Thread
/checkregistered - by Tanush123 - 12.05.2013, 05:20
Re: /checkregistered - by Kwarde - 12.05.2013, 07:07
Re: /checkregistered - by Tanush123 - 12.05.2013, 12:09
Re: /checkregistered - by Vince - 12.05.2013, 12:12
Re: /checkregistered - by Kwarde - 12.05.2013, 12:27
Re: /checkregistered - by Tanush123 - 12.05.2013, 22:53
Re: /checkregistered - by Emmet_ - 12.05.2013, 23:06
Re: /checkregistered - by Tanush123 - 12.05.2013, 23:13
Re: /checkregistered - by Tanush123 - 14.05.2013, 01:27
Re: /checkregistered - by Vince - 14.05.2013, 06:34

Forum Jump:


Users browsing this thread: 1 Guest(s)