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): enter image description here

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.

run php file in cron job using cpanel


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -