ORDER BY SQL
#1

hi, I have the following data on the table

id=0, kills=88
id=1, kills=90
id=2, kills=99
id=3, kills=110
id=4, kills=120
id=5, kills=3300
id=6, kills=789
id=7, kills=55
id=8, kills=33

I sort data
PHP код:
new
    
db_countkills [30], idnexid [30];
sys_result db_query (sys_db"SELECT * FROM `players` ORDER BY `kills` DESC");
db_count db_num_rows(sys_result);
for (new 
!= db_count; ++i)
{
    
db_get_field_assoc (sys_result"kills"sys_field20),
        
kills [idnex++] = strval(sys_field);
    
db_get_field_assoc (sys_result"id"sys_field20),
        
id [idnex] = strval(sys_field);
    
db_next_row (sys_result);
}
db_free_result (sys_result);
for (new 
!= 9; ++iprintf ("id %i, kills %i"id[i], kills[i]); 
That's what happens
Quote:

[22:20:03] id 0, kills 99
[22:20:03] id 3, kills 90
[22:20:03] id 2, kills 88
[22:20:03] id 1, kills 789
[22:20:03] id 7, kills 55
[22:20:03] id 8, kills 3300
[22:20:03] id 6, kills 33
[22:20:03] id 9, kills 120
[22:20:03] id 5, kills 110

must be
Quote:

[22:20:03] id 8, kills 3300
[22:20:03] id 1, kills 789
[22:20:03] id 9, kills 120
[22:20:03] id 5, kills 110
[22:20:03] id 0, kills 99
[22:20:03] id 3, kills 90
[22:20:03] id 2, kills 88
[22:20:03] id 7, kills 55
[22:20:03] id 6, kills 33

it is fixable?
sorry my bad english=)
Reply


Messages In This Thread
ORDER BY SQL - by Mr_Zlodei - 12.01.2014, 12:16
Re: ORDER BY SQL - by Vince - 12.01.2014, 12:29
Re: ORDER BY SQL - by Mr_Zlodei - 12.01.2014, 12:36
Re: ORDER BY SQL - by Konstantinos - 12.01.2014, 12:40
Re: ORDER BY SQL - by Mr_Zlodei - 12.01.2014, 12:45

Forum Jump:


Users browsing this thread: 2 Guest(s)