php/mysql search for date and send email if date is today -


i stored dates in format 6th july,2012 in table. want loop through them , send email admin if date today's date. tried think need concert date format first.

select email, name, phone_no table to_days(date)=to_days(now());  if true send email admin.  //eg. john's birthday today. pls call him on 00001332424; 

thanks

yes, should convert native mysql date/time formats first. storing date string fine , dandy if never have manipulate date. do, you're in world of pain - can't uses indexes, have convert every string every time run query, etc...

once you've converted string native date field, it's simple matter of

select .... datefield=curdate(); 

to give idea what's possible once you've got dates in 'native' format, here's mysql date/time manipulation functions: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

there's lots of them, work on native date fields, not on arbitrary strings (except ones convert string<->native).


Comments