Hang on, there might be sticks being handled by wrong ends here.
Say your table has these 'fields'
id - name - surname
And you're sorting on surname, when you pull out a row with mysql_fetch_row, or mysql_fetch_array, are you expecting
$row[0] to be surname? That won't be the case unless you specify the order like
SELECT surname, name, id FROM table ORDER BY surname DESC;