Hey, I was wondering if someone could help me out writing a code for displaying TOP 10 players by a parameter, for example top 10 with highest score.
I know how to do it in the oldest MySQL, but I havent been around for some time and can't figure out how to do it with the newest version.
This is my old code
I know how to do it in the oldest MySQL, but I havent been around for some time and can't figure out how to do it with the newest version.
This is my old code
Code:
mysql_query("SELECT `Score` ,`User` FROM `table` ORDER BY `Score` DESC LIMIT 10");
mysql_store_result();
new id,output[600], str[64];
while(mysql_retrieve_row())
{
id ++;
new username[24], scorevariable[5];
mysql_fetch_field_row(username, "Username");
mysql_fetch_field_row(scorevariable, "Score");
format(str,sizeof str, "%i. %s - %i score\n",id,username,strval(scorevariable));
strcat(output, str);
}
mysql_free_result();
ShowPlayerDialog(playerid,1945,0,"Score top list",output,"Close","");