Show Next Birthday - PHP & MySQL
My site contains a database of a group of friends, all with profiles and their date of birth entered. I need a query to show when the next birthday & the date it is, also how old they will be.
Next Birthday: Ian Gunter will be 28 on the 11th July
I have come up with this
This selects the first birthday that happens that year, I need it to somehow reference today date and sort from there, but when I use the d_o_b2 field name in the WHERE clause, I get error # 1054 (unknown column).
SELECT id, name_f, name_l, DATE_FORMAT(d_o_b,'%m %D') AS d_o_b2
WHERE d_o_b <=CURDATE()
ORDER BY d_o_b2 ASC
I also can't figure out ho to use the year to work out how old they will be.