0

I'm creating an Ecommerce Website in which I want to create a product Reservation functionality in which the user can reserve the product and after the product is reserved if the user did not checkout that product will be remove from its reservation. For this Purpose I'm thinking about creating a separate reserve_products table in which the reserved products are saved and after 3 days I want to remove that reserved items automatically. So, How can I remove the record automatically from database after 3 days?

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • You can add a date of reservations in the table. Then schedule a daily crib job that will delete records more than three days’ old. – smartdroid Apr 01 '21 at 07:58
  • Use [Event Scheduler](https://dev.mysql.com/doc/refman/8.0/en/event-scheduler.html). Create an event which is fired, for example, each minute, and removes outdated rows. – Akina Apr 01 '21 at 07:58
  • 1st duplicate show solution via mysql event scheduler, the 2nd one via php script scheduled by cron. – Shadow Apr 01 '21 at 08:24

0 Answers0