06.08.2015, 19:48
So Ive got some old code I wanna convert into new SQL version but how do I do that? Im not really good with SQL or such.
This is for testing purposes. The goal is to achieve top players.
1. Yes Im using BlueG's SQL plugin
2. Yes Im aware that some stuff changed
3. Yes im aware a bit bit noobish with SQL
The goal is to get top 10 Score's from players database
This is for testing purposes. The goal is to achieve top players.
pawn Код:
CMD:test(playerid,params[])
{
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))
{
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();
return true;
}
2. Yes Im aware that some stuff changed
3. Yes im aware a bit bit noobish with SQL
pawn Код:
error 035: argument type mismatch (argument 1)
error 017: undefined symbol "mysql_store_result"
error 017: undefined symbol "mysql_fetch_row_format"
error 017: undefined symbol "mysql_free_result"
The goal is to get top 10 Score's from players database