cameron
09-15-2006, 09:30 PM
I'm creating a monthly archive for my blog that has a list of links like the following:
http://www.site.com/archive/2006-09
http://www.site.com/archive/2006-08
http://www.site.com/archive/2006-07
I'm having trouble with my select statement to select only posts from a particular month.
Dates are stored in this format:
2006-08-10 21:50:06
I explode the url to get a month variable off the end, but I haven't been successful in comparing the month and date in my WHERE clause.
Been toying with things like this:
SELECT * DATE_FORMAT(ItemPublished, '%Y-%m') as Published
FROM News
WHERE '$month' = Published
ORDER BY ItemPublished DESC
Any ideas?
http://www.site.com/archive/2006-09
http://www.site.com/archive/2006-08
http://www.site.com/archive/2006-07
I'm having trouble with my select statement to select only posts from a particular month.
Dates are stored in this format:
2006-08-10 21:50:06
I explode the url to get a month variable off the end, but I haven't been successful in comparing the month and date in my WHERE clause.
Been toying with things like this:
SELECT * DATE_FORMAT(ItemPublished, '%Y-%m') as Published
FROM News
WHERE '$month' = Published
ORDER BY ItemPublished DESC
Any ideas?