I have sent_date and status column in my database table.currently status of the post is = Sent/Received. All I want to change the status = Aborted after 5days automatically.
What I tried:
CREATE EVENT reset ON SCHEDULE EVERY 1 day DO
update barter_proposals
set proposal_status="Aborted"
WHERE `sent_date`>=DATE_ADD( CURDATE(), INTERVAL 1 day )
AND proposal_status = "Sent/Received"---------Not worked
CREATE EVENT rot ON SCHEDULE EVERY 1 day DO
update barter_proposals
set proposal_status="Aborted"
WHERE DATE_ADD(sent_date, INTERVAL 1 day )>=NOW()
AND proposal_status = "Sent/Received"---------Not worked
CREATE EVENT rot ON SCHEDULE EVERY 1 day DO
update barter_proposals
set proposal_status="Aborted"
WHERE sent_date=CURDATE()
AND proposal_status = "Sent/Received"-----------Not Worked
How can I update the status automatically after 5 days? sent_date can be anything.
If sent_date is 26/03/2018 then on 01/04/2018, the status should update to Aborted automatically. How can I write the logic?