Okie dokie. I am building a website where people list things for a set amount of time (ex. one week, 3 days, etc.) Once the time of thier listing runs out, it is useless to keep thier entry in the database. Is there any way that I can write a PHP script that automatically runs (maybe once a day) and cleans up the database by removing outdated entries?
Thank you in advance...You guys are awesome!
A script that runs automatically...say...once a day?
Moderator: General Moderators
- evilmonkey
- Forum Regular
- Posts: 823
- Joined: Sun Oct 06, 2002 1:24 pm
- Location: Toronto, Canada
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Another thing you could do is before your site does any work, you could simply check the database for their times, if any of the times are up... it removes it from the database. You'd need to store the initial time that the service started in the database, that way you can check it against the current time. It's basically making a script cron job, which doesn't need your linux service to do it.
If you need me to elaborate more... let me know.
If you need me to elaborate more... let me know.