Forum Moderators: coopster
Interesting problem, I think. Basically all the news items are stored in a database (see table structure below).
itemid int(11)
heading varchar(255)
prop_date varchar(255)
content text
So I need to select heading according to todays date, then another select heading 5 days prior to todays date.
I've been looking at the date function on php.net form some ideas.
Any ideas?
:-)
The query below gets todays news items:
select heading,prop_date from newsfeed where to_days(now()) - to_days(prop_date) = 0 order by prop_date desc;
Thats fine, however I've been trying to get another query so therefore it gets news items from yesterday and 5 days before that.
Obviously I need to alter the now command minus 1 day, see what I mean?
Any ideas?
Thanks again. :-)
date, so to get those that are dated today: SELECT
heading,
prop_date
FROM newsfeed
WHERE prop_date = CURDATE() [mysql.com]
ORDER BY prop_date DESC
;
[edited by: coopster at 5:20 pm (utc) on Mar. 10, 2004]