Can someone please help me with the required syntax for the following query in MySQL
$monthQuery = "SELECT * FROM calendar WHERE mywhen >= CURDATE() AND YEAR(mywhen) = date('Y', strtotime($mywhen)) GROUP BY MONTH(mywhen) ORDER BY mywhen";
It's clearly to do with the date variable got YEAR(mywhen) but I can't get the combination right for a double-quoted statement, although it will work with single-quotes:
$monthQuery = 'SELECT * FROM calendar WHERE mywhen >= CURDATE() AND YEAR(mywhen) = "' . date("Y", strtotime($mywhen)) . '" GROUP BY MONTH(mywhen) ORDER BY mywhen';
It just seems dreadfully ugly...
Help?