Jump to content

MySQL Automatic Entry Manipulation


GregL83

Recommended Posts

I am creating a website with USER ACCESS and want the users to add themselves to a list that will be present until a certain time of night. I wanted my server to automatically remove the entries from the list at a certain time and date. I will also work to create a timezone depending on the location of the event. The list will change and always remove entries once passed the expiration date and time. How can you automatically manage a server without having to go through the MySql database and do it yourself??

Link to comment
Share on other sites

Basically whenever the page you are doing this on is loaded, before you do anything else, run through and delete the values from the database that are less than the current time(-timezone offset in seconds). Then you continue on with whatever you are doing normally.I had this same problem with something on a project i was doing. Articles were only supposed to be pinned to the frontpage for a certain amount of time, once that time was over, they were supposed to be deleted and the next one in the database que was supposed to show up. That was my solution to this particular problem.

Link to comment
Share on other sites

You could also use Cron (usually available though the control panel for your host) to schedule a PHP script to run at a certain time which performs the operation.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...