How do you make a mysql database automaticly clear on a specific time at a spacific day?
Such as Monday at 00:00.
Thanks.
Printable View
How do you make a mysql database automaticly clear on a specific time at a spacific day?
Such as Monday at 00:00.
Thanks.
Cron Jobs.
http://www.aota.net/Script_Installat.../cronhelp.php3 :| as posted a min ago..
MySQL:
TRUNCATE TABLE `table_name` ;
'Cus that'll run automaticaly at 00:00 :rolleyes:Quote:
MySQL:
TRUNCATE TABLE `table_name` ;
No, Simon just e-bullies me. :'(
May've got that wrong.PHP Code:$time = date("H:i");
if($time == "00:00"){
$query = mysql_query("TRUNCATE TABLE `table_name` ;");
}
<?php
include "config.php"; // config file
$query = mysql_query("TRUNCATE TABLE `table_name` ;");
?>
go into cPanel.
Go to cron jobs, put the command as:
wget http://www.site.com/myfile.php
Then set the time to everyday at 00:00 of every week of every month of every year.
you set the cron to run the file at the time you want it delete and also
Simon why are u so up your self?
Just because someone else helped more then you.
Yeah, just ignore me. ('ere.)
I made it so that it deletes them, but also re adds them at the same time :)
Re-adds the table structure? That's exactly what TRUNCATE does, anyway :P