lundi 1 juin 2015

reload webpage certain timing even no one use it

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://ift.tt/1FmjxMd

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"); 




Aucun commentaire:

Enregistrer un commentaire