20.10.2016, 13:21
All can be done in 1 query and you don't need formatting (the query) too. When selecting 1 field, the fieldid would be 0 and not 5.
PHP код:
new rank_info[200], player_name[MAX_PLAYER_NAME], DBResult: result = db_query(Database, "SELECT `NAME`,`RANK` FROM `USERS` ORDER BY `RANK` DESC limit 10");
for (new a; db_next_row(result) != 0; a++)
{
db_get_field(result, 0, player_name, sizeof player_name);
format(rank_info, sizeof(rank_info), "%d. %s - Rank: %d", a + 1, player_name, db_get_field_int(result, 1));
// client message
}
db_free_result(result);
// or dialog..