Suppose I have a month and a year (this is for a blog application):
$month = 10; // October
$year = 2005; // year 2005
I'd like to select items on or before the last day of October 2005 in
descending order. My first attempt was:
echo "SELECT * FROM $tblPosts " .
"WHERE MONTH(postDate)<=$month & YEAR(postDate)<=$year " .
"ORDER BY postDate DESC, id DESC LIMIT $to_request");
but for some reason, this is selecting ALL records.
Given a month and year, how do I select any item with a postDate (which is a
datetime field) on the last day of ...