• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] TOP 10 MySQL list
#1
Heart 
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
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","");
  Reply


Messages In This Thread
TOP 10 MySQL list - by Blood - 2024-06-30, 04:52 PM
RE: TOP 10 MySQL list - by PainFrenemy - 2024-07-28, 07:12 PM

Forum Jump: