May I know If it is possible?
Updating MySQL Database without using button, I mean something like script.
Scenario:
I want to have running script that will search for a value that will meet the condition I want then it will automatically update the value.
Example:
I have the columns named - dateStarted
, dateExpiration
and status
so if dateExpiration
is today it will change the value of status
from ACTIVE
to INACTIVE
.
PS: dateStarted
+ 30 days = dateExpiration
This is my ideal codes so far but don't know how I will call the data and update it without using button something like it must be running in background.
$dateExpired = date('Y-m-d', strtotime($dateStart. ' + 30 days'));
$dateExpired2 = date('Y-m-d', strtotime($dateStart. ' + 90days'));
$status = "FRESH";
if(strtotime($dateStart)<strtotime('-30 days')){
$status = "INACTIVE";
}
if(strtotime($dateStart)<strtotime('-90 days')){
$status = "DORMANT";
}
Thank you.