Page 1 of 1
archiving news items
Posted: Mon Dec 05, 2005 9:00 am
by hame22
Hi
I have got a collection of news articles held in a database that I wish to archive.
What I want to do is to display groups of articles as to the month and year that they were published,
e.g. Jan 2004 Articles, Feb 2004 Articles etc
I want this to be on going for the future so it can maintain itself,
I was wonderingif anyone knew how to do this or any scripts available?
Thanks
Posted: Mon Dec 05, 2005 9:21 am
by foobar
That depends what your database looks like. Can you dump the create statements for your tables and post them here? Otherwise, there's little I can do to help you.
Posted: Mon Dec 05, 2005 9:26 am
by markg85
well.. there must exists scripts like that on
http://www.hotscripts.com/PHP/Scripts_a ... index.html (hotscripts) but the bad thing about that is that those functions will most likely be hard coded in the script and not easy o get them out...
and besides that.. i`m also looking for a easy way to do this

Posted: Mon Dec 05, 2005 10:20 am
by hame22
Code: Select all
CREATE TABLE `rss` (
`rss_id` int(50) NOT NULL auto_increment,
`headline` varchar(255) NOT NULL default '',
`content` text NOT NULL,
`news_url` varchar(255) NOT NULL default '',
`pub_date` date NOT NULL default '0000-00-00',
`image` varchar(255) NOT NULL default '',
PRIMARY KEY (`rss_id`)
) TYPE=MyISAM AUTO_INCREMENT=21 ;
is that what you wanted?
thanks
Posted: Mon Dec 05, 2005 10:30 am
by onion2k
Well .. to get all the articles published in (for example) Feb 2005 ..
Code: Select all
select * from rss where MONTH(pub_date) = 2 and YEAR(pub_date) = 2005
That's all you need to know..
Posted: Mon Dec 05, 2005 10:33 am
by Jenk
make use of the date (and it's children) syntax in your select statements.
http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html