I have a DATE field on a mysql db that stores users birthdays (the month
and the day, the year doesn't matter). I am trying to have a query that
returns the names of those whose birthdays are today. Currently I am
returning everyones birthdays and then looping through them doing a
string comparison. Can't I do this work in the query?
Something like:
$bday_qry="SELE CT user_fname, user_lname, user_bday
FROM users
WHERE DATE_FORMAT(use r_bday, %m-%d)==".date("m-d");
What's the best way to do this?
Thanks,
Steve
and the day, the year doesn't matter). I am trying to have a query that
returns the names of those whose birthdays are today. Currently I am
returning everyones birthdays and then looping through them doing a
string comparison. Can't I do this work in the query?
Something like:
$bday_qry="SELE CT user_fname, user_lname, user_bday
FROM users
WHERE DATE_FORMAT(use r_bday, %m-%d)==".date("m-d");
What's the best way to do this?
Thanks,
Steve
Comment