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