|
Posted by CJ Llewellyn on 06/29/05 00:18
On Tue, 28 Jun 2005 12:52:48 -0700, frizzle wrote:
> Hi there,
>
> Short question:
> Is there any way, to reverse the result of a mysql query?
>
> Explanation:
> If i have eg. 20 records, all with their own id of course,
> select 5 with limit, and order them DESC by ID, it should give
> me: 20, 19, 18, 17, 16. That's all ok.
> But now i want 16 to appear first, 17 second, etc.
You can read the result set in reverse order
Use
http://uk.php.net/manual/en/function.mysql-num-rows.php
to find the number of rows, then use a for loop to count backwards reading
each field using:
http://uk.php.net/manual/en/function.mysql-result.php
Navigation:
[Reply to this message]
|