How to change table records in the Database after 30 days?

1

How do I create a condition in PHP that changes the record of a field in a column in the database every 30 days?

Example:

if ( $valor == 'value_1'){
   // Função que altera o registro
}

value_2 // Value for which to change

meta_value // Field that stores the value

wp_usermeta // Table

Every 30 days.

    
asked by anonymous 01.02.2017 / 19:50

1 answer

1

As colleague @Diego commented you will have to create a task on windows or Linux crontab, remembering this should be done on the server. In the longer you will run the sql below using your connection to DB

Update 
   wp_usermeta
set 
   meta_value = 'value_2' 
Where
  --verifique se há necessidade disto

In addition, as a separate wordpress script will be able to use a DB connection using the command mysqli_query

    
01.02.2017 / 21:43