php - How to make use of 'Date of birth' column to send birthday greetings -
i writing script select people database month , day of birth fall on current month , day , send them birthday greetings e-mail. need sql code, pick there , tie cron job.
i have used number of codes not run. code used last is:
select name_of_staff, email, date_of_birth staff_dossier month(date_of_birth) = month(now()) , dayofmonth(date_of_birth) = dayofmonth(now());
//send mail code follows...
my problem extract month , day parts in date_of_birth
column necessary , use determine whom birthday greetings go.
may please me please.
if want list of employees birth month , date matches current date/month, should able use functions month()
, day()
:
select name_of_staff, email, date_of_birth staff_dossier month(date_of_birth) = month(now()) , day(date_of_birth) = day(now());
see sql fiddle demo
Comments
Post a Comment