I want create a website certain time of the day(e.g. 9pm) will auto reload the webpage .
The main point to reload the webpage is to insert some data into database at certain time even no one viewing at the webpage.
My Idea:
Database A : Everytime reach 12am , they will update all the data to 0.
Database B : Want to insert data from database A to track the old data:
INSERT INTO `report`(`updated_date`, `name`, `occupied`) VALUES ('$time','S','$arrayS[$i]')
Due to Database_A 12am will always auto update all the data to 0 , so I need to store the data to Database B. So the User will be able to view the old data.
Current Date is base on Database A and Previous data base on DatabaseB:
(image example :) http://gyazo.com/54e93de27690291a80a3be0d07868b66
I have research afew method and tried out :
1.This method only work when I was viewing the web.However after I close ,no action will be taken.
$page = $_SERVER['PHP_SELF'];
$now = time();
$today = strtotime('12:12');
$tomorrow = strtotime('tomorrow 12:12');
if (($today - $now) > 0) {
$refreshTime = $today - $now;
} else {
$refreshTime = $tomorrow - $now;
}
header("Refresh: $refreshTime; url=$page");