View Full Version : How do you automatically clear a table?
.:Jack120:.2
01-11-2007, 07:03 PM
How do you make a mysql database automaticly clear on a specific time at a spacific day?
Such as Monday at 00:00.
Thanks.
Invent
01-11-2007, 07:04 PM
Cron Jobs.
Jamie.
01-11-2007, 07:05 PM
http://www.aota.net/Script_Installation_Tips/cronhelp.php3
.:Jack120:.2
01-11-2007, 07:05 PM
Cron Jobs.
Humm, i must of typed that in a dif window.
I know its done by cron jobs, but how do you do that =]
Jamie.
01-11-2007, 07:06 PM
http://www.aota.net/Script_Installation_Tips/cronhelp.php3 :| as posted a min ago..
.:Jack120:.2
01-11-2007, 07:09 PM
http://www.aota.net/Script_Installation_Tips/cronhelp.php3 :| as posted a min ago..
I was replying before you posted.
Humm, Iv never got cron jobs. I gave in on them when they didnt work.
What type of commands would clear a table in a database :s
lolwut
01-11-2007, 07:12 PM
MySQL:
TRUNCATE TABLE `table_name` ;
.:Jack120:.2
01-11-2007, 07:18 PM
MySQL:
TRUNCATE TABLE `table_name` ;
What do I do with that exactly?
Invent
01-11-2007, 07:33 PM
MySQL:
TRUNCATE TABLE `table_name` ;
'Cus that'll run automaticaly at 00:00 :rolleyes:
.:Jack120:.2
01-11-2007, 07:36 PM
'Cus that'll run automaticaly at 00:00 :rolleyes:
Simon, you seam to be good with all this. Can you help me pls...
Ill bribe you with money if you wish?
lolwut
01-11-2007, 07:51 PM
No, Simon just e-bullies me. :'(
$time = date("H:i");
if($time == "00:00"){
$query = mysql_query("TRUNCATE TABLE `table_name` ;");
}
May've got that wrong.
Dentafrice,
01-11-2007, 10:56 PM
<?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.
.:Jack120:.2
02-11-2007, 02:32 PM
<?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.
Humm, how do you do it so it deletes say:
the data in 00:00 etc..?
DeejayMachoo$
02-11-2007, 04:16 PM
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.
Jamie.
02-11-2007, 04:27 PM
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.
:| there is no need to be so rude.
lolwut
02-11-2007, 05:02 PM
Yeah, just ignore me. ('ere. (http://www.habboxforum.com/showpost.php?p=4077622&postcount=11))
.:Jack120:.2
03-11-2007, 01:10 AM
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
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.