Friday, 6 September 2013

PHP: Update MySQL entry based on certain date

PHP: Update MySQL entry based on certain date

I have an entry in my database, and when a certain date hits I want to
update the entry.
Here's an example:
+----+----------+-------------+---------+
| id | title | exiryDate | status |
+----+----------+-------------+---------+
| 23 | my title | 10-Sep-2013 | active |
+----+----------+-------------+---------+
My code is written in PHP and the idea is that when the date hits 10th
September, the 'status' of the entry will update to expired instead of
active.
How could I update the entry in DB based on date?
I suppose I could run a check on page load every time someone visits the
page, but what if I want to update the entry without someone necessarily
visiting the site or the web page?

No comments:

Post a Comment