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.

  1. start mysql event scheduler executing following query in phpmyadmin or mysql command prompt.

enter this.

set global event_scheduler = 1; 
  1. this update table.

    create event newevent on schedule every 1 day update table set status="expired" datefield<=current_date - interval 30 day;


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -