Change the value after expiration date PHP MYSQL -
i'm beginner in php mysql, have system after register/add customer information change status after 30 days.
scenario
in add customer page, have forms date start, date expiration , status.
date start - automatically set date today
expiration - automatically set date start + 30 days
expiration2 - automatically set expiration date + 90 days
status - status of customer (if newly registered status value fresh
if after 30days status change inactive
if after 90days change dormant
.
this code datestart
, dateexpired
, dateexpired2
don't know how code status
process.
$datestart= date('y-m-d'); $dateexpired = date('y-m-d', strtotime($datestart. ' + 30 days')); $dateexpired2 = date('y-m-d', strtotime($dateexpired2. ' + 90days')); echo '<input type="text" name= "datestart" value="'. $datestart.'"/>'; echo '<input type="text" name= "dateexpired" value="'. $dateexpired .'"/>';
if run script @ scheduled interval, can automatically update user's status':
$datestart= date('y-m-d'); $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"; } //run sql update query set status
see here sql update query
Comments
Post a Comment