re-sort query results?
Date: 10/10/06
(PHP Community) Keywords: mysql, sql
My brain is fried. I have a query that gets the last 5 items from a mysql table by ordering them in descending order and limiting them to 5 (ORDER BY ID DESC LIMIT = 5). But, I then need to display the results in ASC order.
I am using some legacy code I am not entirely familiar with (the "$this->" operator), and I feel a little lost. Any ideas?
Current code:
$this->DBQuery("SELECT * FROM ".$this->table[3]." WHERE adate<='".$adate."' AND ".$sectionID." AND ".$priority." AND ".$authorID." AND status=1 ORDER BY ID DESC LIMIT ".$articlenumber);
Source: http://community.livejournal.com/php/501510.html