php - update column if date is older than 30 days -
i have table have column name 'date' , column name 'status' if use cron job run everyday , check if date older 30 day change status expired, code need run using mysqli , php.
mysql event scheduler more better.
- start mysql event scheduler executing following query in phpmyadmin or mysql command prompt.
enter this.
set global event_scheduler = 1;
this update table.
create event newevent on schedule every 1 day update table set status="expired" datefield<=current_date - interval 30 day;
Comments
Post a Comment