timmylogue Posted April 10, 2015 Share Posted April 10, 2015 I'm trying to search for passed dates (30 days ago) in my database and then INSERT 'expired' value into a column called 'trial_date_ended'. The dates/passed dates are in a column field called "trial_date_started" Here an example of what I thought would work but doesn't work: $sql="INSERT INTO users (trial_date_ended) VALUES ('expired') < (NOW() - INTERVAL 30 DAY)"; Thanks for your help! Tim Link to comment https://forums.phpfreaks.com/topic/295394-find-30-days-ago-and-insert/ Share on other sites More sharing options...
Barand Posted April 10, 2015 Share Posted April 10, 2015 Sounds like you need an UPDATE query UPDATE users SET trial_date_ended = 'expired' WHERE trial_date_started < CURDATE() - INTERVAL 30 DAY Link to comment https://forums.phpfreaks.com/topic/295394-find-30-days-ago-and-insert/#findComment-1508661 Share on other sites More sharing options...
timmylogue Posted April 10, 2015 Author Share Posted April 10, 2015 Thank you! Worked! Link to comment https://forums.phpfreaks.com/topic/295394-find-30-days-ago-and-insert/#findComment-1508682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.