Reply to Re: Fetching

Your name:

Reply:


Posted by ELINTPimp on 05/22/07 16:11

On May 22, 4:04 am, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
> java.inet wrote:
> > how to fetch the last five records in mysql through php
>
> Don't. Modify your SQL to only select the last five records.
>
> SELECT x.*
> FROM (SELECT *
> FROM table
> ORDER BY sortorder DESC
> LIMIT 5) x
> ORDER BY x.sortorder
>
> --
> Toby A Inkster BSc (Hons) ARCShttp://tobyinkster.co.uk/
> Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

completely agree with Toby. I used the exact method when designing a
module that displayed a summary of the 5 most recent help desk tickets
on our network management home page. always try to query only what
you need from a database, anything more is just unnecessary overhead.

[Back to original 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

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