mathewjenkinson Posted August 20, 2008 Share Posted August 20, 2008 Hi all, Im trying to set up a small news site. One of the features I would like is 'Recent news' where the last 5 created articles headline can be displayed along with a link to that article. The DB has been set up with 'article_id', 'Article_name' etc. so I was thinking about basically working back words from the highest article number and displaying those 5. but I have no clue how I would go about doing that... Anyone have any ideas? Thanks Mathew Link to comment https://forums.phpfreaks.com/topic/120608-last-5-articles-in-a-db-displayed-on-a-page/ Share on other sites More sharing options...
Mchl Posted August 20, 2008 Share Posted August 20, 2008 SELECT * FROM articles ORDER BY article_id DESC LIMIT 5 Personally I'd rather store the date article is published and sort them on it... Link to comment https://forums.phpfreaks.com/topic/120608-last-5-articles-in-a-db-displayed-on-a-page/#findComment-621466 Share on other sites More sharing options...
mathewjenkinson Posted August 20, 2008 Author Share Posted August 20, 2008 Thanks for the help. the next bit is the date. but still need to decide if i want to let people edit the story after its been published. Link to comment https://forums.phpfreaks.com/topic/120608-last-5-articles-in-a-db-displayed-on-a-page/#findComment-621470 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.