mySQL top 10
#4

pawn Code:
mysql_query("SELECT `Name`, `Score` FROM `players` ORDER BY `Score` DESC LIMIT 10");
mysql_store_result();
new szPrepTD[460], iIterator = 1, iScore, szName[MAX_PLAYER_NAME], szUnload[64];
while(mysql_fetch_row_format(szUnload)) {
// This code will repeat ten times.
sscanf(szUnload, "p<|>sd", szName, iScore);
if(strlen(szPrepTD) == 0) format(szPrepTD, sizeof(szPrepTD), "#%d - %s (%d score)\n", iIterator, szName, iScore);
format(szPrepTD, sizeof(szPrepTD), "%s#%d - %s (%d score)\n", szPrepTD, iIterator, szName, iScore);
iIterator++;
}
mysql_free_result();
Use 'szPrepTD' as the string to set your textdraw. Something like this will work, I haven't tested this though. Rename fields as necessary and whatnot.
Reply


Messages In This Thread
mySQL top 10 - by MP2 - 18.07.2011, 11:44
Re: mySQL top 10 - by Lorenc_ - 18.07.2011, 12:06
Re: mySQL top 10 - by MP2 - 18.07.2011, 12:11
Re: mySQL top 10 - by Calgon - 18.07.2011, 12:24
Re: mySQL top 10 - by MP2 - 18.07.2011, 12:30
Re: mySQL top 10 - by Calgon - 18.07.2011, 12:37
Re: mySQL top 10 - by MP2 - 18.07.2011, 12:41
Re: mySQL top 10 - by Calgon - 18.07.2011, 12:44
Re: mySQL top 10 - by MP2 - 18.07.2011, 13:10
Re: mySQL top 10 - by Calgon - 18.07.2011, 13:12

Forum Jump:


Users browsing this thread: 1 Guest(s)