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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.