This can also be done only in PHP, without modifying the SQL query, simply repeating it back through the result set:
$res = mysql_query(...);
for($i=mysql_num_rows($res)-1; $i>=0; $i--) {
//do whatever
}
I admit that I do not know what the difference in performance is (if any), but this is just another option that may satisfy you.
source
share