Mysql to sql.
#2

Yes, the SQL Query will work.
Btw, your code can be optimised to:
PHP код:
stock LoadTop10()
{
    
mysql_function_query(mysql"SELECT * FROM `players` ORDER BY `score` DESC LIMIT 10 "false"LoadScores"""""); //init the load scores function with no cache
    
return 1// returning the function true
}
public 
LoadScores()
{
    new 
rowsfields;
    
cache_get_data(rowsfieldsmysql); //returning all 10 players & all their rows/fields
    
if(!rows)//if there are rows to be retrived continue
    
{
               
printf("There are no players saved with score..");
               return 
1;
        }
    new 
dest[24], score;
        
printf("top 10:");
    for(new 
0rowsi++) //loop through all the found rows and pull the following
    
{
        
cache_get_row(i"pName"dest);         //get the name of the player on the position i
        
score cache_get_row_int(i"score");  //get the score of the player on the position i
        
printf("#%d %s with %d"destscore); //print the player on the position i name and score
    
}
    return 
1;

Reply


Messages In This Thread
Mysql to sql. - by dani18 - 19.05.2018, 05:20
Re: Mysql to sql. - by 10MIN - 19.05.2018, 08:24
Re: Mysql to sql. - by Dayrion - 19.05.2018, 10:16
Re: Mysql to sql. - by GTLS - 19.05.2018, 10:19
Re: Mysql to sql. - by CodeStyle175 - 19.05.2018, 10:23
Re: Mysql to sql. - by dani18 - 19.05.2018, 14:40
Re: Mysql to sql. - by GTLS - 20.05.2018, 05:48
Re: Mysql to sql. - by dani18 - 20.05.2018, 15:44

Forum Jump:


Users browsing this thread: 2 Guest(s)