cloudrunner
cloudrunner

Reputation: 489

Delete a table row in SQL using PHP using date parameters

How can I delete a table row in using PHP and SQL?

For example when a scheduled event has passed the scheduled date, it is automatically deleted from the table, like an expiration date so to speak. I am currently making a reservation system for scheduled events.

Upvotes: 0

Views: 411

Answers (2)

dllhell
dllhell

Reputation: 2014

A cron job can be a solution but I rather use a jobs/events on databases for tasks running on databases. Create a stored procedure which will delete desired rows triggered by database job/event.

Upvotes: 1

Nirmal
Nirmal

Reputation: 9549

Deploy a cron job which runs regularly (like once in 15 minutes) and make it delete the rows that are older than a specific date and time.

There is no expiration feature in SQL.

Upvotes: 2

Related Questions