Hi, I am trying to select data from a mysql table and I want to target songs with today's date.
Here is my code:
"SELECT songid, stitle FROM songs WHERE sdate = CURDATE() ORDER BY srating DESC LIMIT 3";
This didnt work. If I take out this line:
WHERE sdate = CURDATE()
It runs fine selecting from all songs, not just todays.
'sdate' is a datetime field. I uploaded to songs today and they are listed in mysql as "2004-10-28 18:31:56" in my sdate column. Will curdate() work with datetime or does the field need to be date?
This also didnt work:
"SELECT songid, stitle, DATE_FORMAT(sdate, '%Y-%m-%d') AS sdate FROM songs WHERE sdate = CURDATE() ORDER BY srating DESC LIMIT 3";
Help!
Thanks