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

Asked

Viewed 80 times

1

How do I create in PHP a condition 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 to be changed

meta_value // Field that stores the value

wp_usermeta // Table

Every 30 days.

  • PHP alone will not do that. What you can do is create a PHP script that does what you want and call it by Windows task scheduler or cron on Linux.

1 answer

1

Like the colleague @Diego commented you will need to create a task in windows or crontab of Linux, remembering that this should be done on the server. Further you will run the sql below using your BD connection

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

Furthermore, as it will be a separate wordpress script you can use a BD connection using the command mysqli_query

Browser other questions tagged

You are not signed in. Login or sign up in order to post.