View Full Version : Automatic Truncation of MySQL Database

04-18-2004, 08:14 PM
I've a php page that displays a simple list of the users currently logged into my website.
What I want is that this page truncates another MySQL database table, at midnight automatically.
I already now how to connect to the database and to trunctate the table, but i can't work out how to do it automatically at midnight.
Is it possible to set it up so that it automatically does it regardless of whether the page is being displayed? (or should i be asking this part of the question in the MySQL forum?)

Many thanks in advance,

04-18-2004, 09:53 PM
Multiple option. You either write a batchfiel and run mySQL in commandmode to truncate the table, otr you write a PHP page that will do it over the webserver.
For the timer, you need to set up a CRON job (Unix/Linux systems) or Scheduled Task (Windows).