Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Edinburgh, UK
    Thanked 1 Time in 1 Post

    Automatic Truncation of MySQL Database

    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,

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #2
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Thanked 0 Times in 0 Posts
    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).
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts