You are here: Re: Reverse mysql-result « PHP Programming Language « IT news, forums, messages
Re: Reverse mysql-result

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация