You are here: Re: PHP and MySQL « PHP SQL « IT news, forums, messages
Re: PHP and MySQL

Posted by George on 10/31/05 21:09

In article <H1f9f.15925$MN6.7857@fed1read04>, scott Johnson says...
>
>Well you will probably need to add an extra field and fill it with the
>date the message was added.
>
>Then do a query.
>
>"SELECT * FROM news ORDER BY date_added ASC LIMIT 5"
>

If the table has a primary key, such as an integer, that would have to be unique
and could just sort on that. Would save the hassle of adding an extra column if
the date information isn't needed.

George
--
Basic Newsguy -- 3 GB / month -- $39.95 / year
http://newsguy.com/overview.htm



>Colin Roosendaal wrote:
>> Hello,
>>
>> Can someone tell me how to do the following:
>>
>> I'm looking for the PHP/MySQL query to get the last 5 added records from my
>> database.
>>
>> For your info
>>
>> DB name: news
>> table name: messages
>>
>> I hope you can help me.
>>
>> Thanks,
>>
>> Colin Roosendaal
>>
>>
>

 

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

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