PDA

View Full Version : give ideas for creating history page


crystal nano
12-27-2009, 12:38 PM
i have a news website in asp. i want to create a history page in which i want that history of news show. i want some help that how i create that page.i want suggestions form all of you that how i create the history page. any website from which i find help then please tell me.and please give some ideas to create the history of news.

telmessos
12-30-2009, 07:25 AM
if you use a database, you can simply add a field with true/false values. The records which are set true will be shown on the news page. False valued ones will be shown on the history pages.

Old Pedant
12-30-2009, 11:34 PM
But probably better would be to have a DATETIME field that marks when the article was added.

And then you can just show the most recent NN news items as current with all else being history.

MySQL: SELECT * FROM NewsItems ORDER BY NewsDate DESC LIMIT 10;

Other DBs: SELECT TOP 10 * FROM NewsItems ORDER BY NewsDate DESC;

crystal nano
12-31-2009, 08:33 AM
i just want to display yesterday and 2 days ago history. wht should i do??

Old Pedant
12-31-2009, 08:13 PM
What database are you using??

MySQL:
SELECT * FROM news WHERE articleDate >= DATE_SUB(CURDATE(),INTERVAL 2 DAY);

Access:
SELECT * FROM news WHERE articleDate >= DATE()-2

SQL Server:
SELECT * FROM news WHERE articleDate >= ( CONVERT(DATETIME,CONVERT(VARCHAR(20),getDate(),112),112 ) - 2