php - Sql date between query with a date and number of days -
i have table called renewals follows
id | item_name | next_renewal_date | alert_before_days 2 | test | 2015-05-25 | 5 6 | test4 | 2015-05-12 | 2 7 | test7 | 2015-05-30 | 12
i read table alert_before_days. example, need rows upcoming renewals alert_before_days current date onwards.
i'm using cakephp , tried following, nothing works. selects date 1970-01-01
'conditions'=>array('renewal.nextrenewaldate <=' => date('y-m-d', strtotime("+renewal.alertbeforedays days"))
strtotime
not recognize expression. mysql
-
'conditions'=>array( 'renewal.nextrenewaldate <=' => 'date_add(now() + interval `renewal`.`nextrenewaldate` day)' )
Comments
Post a Comment