Karuppiah RK
Karuppiah RK

Reputation: 3964

reset mysql table column every day, week, month

I want to reset my mysql table column every day (12 AM), week and month. I have just single row in my mysql table.

$current_date = date_default_timezone_set('Asia/Kolkata');
$current_date = date('H:i:s');
$timestamp = strtotime($current_date);
$gettime = date("h:i A", $timestamp);
if($gettime == "11:59 PM")
{
    update mysql table column to 0 ???          
}

I have tried this above code for reset table column every day. But, I'm not sure. Is this the right way to reset column? If it is correct then How do I do this for week and month?

Upvotes: 0

Views: 880

Answers (1)

Youngsik Oh
Youngsik Oh

Reputation: 54

What about use crontab?

Make a shell script with mysql command line tool.

Upvotes: 0

Related Questions