23.03.2015, 15:15
I want to get players rank by score from mysql.
example: John 5, Jones 4
Ant function would return John as #1.
Tryed:
it executes succesffuly, but latter in debug i can see CMySQLHandler::RetrieveRow() - You cannot call this function now. (Reason: Empty Result)
example: John 5, Jones 4
Ant function would return John as #1.
Tryed:
pawn Код:
stock GetPlayerMYSQLrank(playerid)
{
new str[20], Query[150];
format(Query, sizeof(Query), "SELECT COUNT(user) AS rank FROM `playerinfo` WHERE score >= (SELECT score FROM playerinfo WHERE user = '%s')", pName(playerid));
mysql_query(Query);
mysql_store_result();
if(mysql_retrieve_row())
{
mysql_fetch_field_row(str,"rank");
}
return strval(str);
}