php - mySQL script to get results in given date and insert into table -
i'm struggling days (what think) pretty advanced operation plan schedule run in database every week.
this structure of table (unit_uptime_daily):
what need run script every week that, every unit_id exists in table, gets rows of unit_id thats timestamp present day < 6 days (so unit_ids timestamp of previous week) add total_uptime column of 7 rows , insert new row weekly table.
effectively, grabbing 7 latest rows each unit_id, adding total_uptime , inserting unit_id, result of added total_uptime , timestamp new table.
thanks in advance, if possible do!
use cron jobs. of hosting providers provides facility. google cron jobs
find more , here's answer you.
Comments
Post a Comment