I know that I am not the first to ask how to display upcoming birthdays. But, unfortunately, all the other answers did not help me figure out how to do this.
I have a database with the following structure:
Id - Birthday
1 9/14/1996
2 8/27/1990
-- --
As you can see, the date of birth is saved in the "Birthday" field. And I would like to show you five upcoming birthdays (including birthdays today).
But how can I do this? I tried this, but this did not work:
$query="SELECT Id
FROM participants
WHERE DATE_ADD(STR_TO_DATE(birthday, %n/%j/%Y), INTERVAL YEAR(CURDATE())-YEAR(STR_TO_DATE(birthday, %n/%j/%Y)) YEAR)";
Thanks for the help!
Jordy source
share