JKG Posted September 24, 2011 Share Posted September 24, 2011 any one know of any scripts to archive news items by timestamp? google searches just show tonnes of news archives.. not what i want! obviously using php, all news items have a timestamp, how would i go about this? very open ended question but ANY help would really be appreciated. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/247777-archiving-by-timestamp/ Share on other sites More sharing options...
WebStyles Posted September 24, 2011 Share Posted September 24, 2011 are you talking about files (i.e. scans of news clippings in jpeg or something) or articles stored in a database with a timestamp? Quote Link to comment https://forums.phpfreaks.com/topic/247777-archiving-by-timestamp/#findComment-1272425 Share on other sites More sharing options...
JKG Posted September 26, 2011 Author Share Posted September 26, 2011 Hi WebStyles thanks for the reply. I am talking about news items stored in a database with a timestamp. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/247777-archiving-by-timestamp/#findComment-1272814 Share on other sites More sharing options...
WebStyles Posted September 26, 2011 Share Posted September 26, 2011 and by 'archiving' do you want to simple display them grouped by month, or actually move them to another table? Quote Link to comment https://forums.phpfreaks.com/topic/247777-archiving-by-timestamp/#findComment-1272817 Share on other sites More sharing options...
JKG Posted September 26, 2011 Author Share Posted September 26, 2011 just aesthetically. group by month automatically. thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/247777-archiving-by-timestamp/#findComment-1272818 Share on other sites More sharing options...
WebStyles Posted September 26, 2011 Share Posted September 26, 2011 then you can use something like: EXTRACT (MONTH from `date`) in your mysql query. check out other options, depending on the type of field you're using (INT with unix timestamp, or mysql timestamp) here: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_extract hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/247777-archiving-by-timestamp/#findComment-1272820 Share on other sites More sharing options...
JKG Posted September 26, 2011 Author Share Posted September 26, 2011 thanks for this. in the end i used SELECT *, MONTH(`timestamp`) as `Month`, YEAR(`timestamp`) as `Year` FROM `news` order by timestamp desc but your suggestion got me on the right path. much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/247777-archiving-by-timestamp/#findComment-1272853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.