Wondered if anyone could help me.
I've got a table of data with years formatted as YYYY-MM-DD and I am looking to implement an "On this day" type feature on to the site. I've been struggling with coming up with a way of pulling out the data though where it matches the current month and day regardless of the year.
So far I've though of using a simple query like:
But my results are failing, so I guess I need a wildcard to recognise the year?
Is there a better solution?
I've got a table of data with years formatted as YYYY-MM-DD and I am looking to implement an "On this day" type feature on to the site. I've been struggling with coming up with a way of pulling out the data though where it matches the current month and day regardless of the year.
So far I've though of using a simple query like:
PHP:
$currentday = date('d');
$currentmonth = date('m');
SELECT * FROM table WHERE date LIKE $currentmonth AND $currentday
But my results are failing, so I guess I need a wildcard to recognise the year?
Is there a better solution?