Jump to content

is a 24/7 refreshing script possible!?


unistake

Recommended Posts

Hi all,

 

I have a list of information that needs to be individually deleted from mysql after 3 months of being on the website.

 

How would I go about this - can one make a php script run 24 hours a day or maybe just refresh at a certain time everyday to check each row (about 300 rows total) in a mysql db and delete as appropriate?

 

Many thanks

Link to comment
https://forums.phpfreaks.com/topic/220603-is-a-247-refreshing-script-possible/
Share on other sites

You can schedule a script to run whenever you want (like once a day). Exactly how depends on the operating system. Google keywords include "cron" (for Linux) and "task scheduler" (for Windows). Don't forget to add "php" to your query.

With PHP, it's generally a bad idea to make something that runs continuously. It's not meant for that.

 

If you're thinking in terms of "garbage collection" (ie, you want to delete old data because it's old and taking up space) then you can just insert some code into your website that randomly (like 1% chance each time it's run) scans for old information and deletes it. No need for a scheduler then.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.