Ordering list of names in descending order according to their score
#1

Below you can see how I attempted to generate a list of the top 5 players by their score and send their names to be displayed in a textdraw. I'm not the most literate in SQL aside from basic queries and what I have below is just what I scrambled up after reading a few Stack Overflew things.

pawn Код:
new query[200],result[32];

format(query,sizeof(query),"SELECT * FROM users ORDER BY Score DESC LIMIT 0,1");
mysql_query(query);
mysql_store_result();
mysql_fetch_field_row(result, "AccountName");
mysql_free_result();
format(topplayer1,sizeof(topplayer1),result);
print(topplayer1);

format(query,sizeof(query),"SELECT * FROM users ORDER BY Score DESC LIMIT 1,1");
mysql_query(query);
mysql_store_result();
mysql_fetch_field_row(result, "AccountName");
mysql_free_result();
format(topplayer2,sizeof(topplayer2),result);
print(topplayer2);

//and so on
My print lines return "<null>" and that's it.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)