Title: Update database automatically
Last modified: April 19, 2019

---

# Update database automatically

 *  Resolved [r0ss26](https://wordpress.org/support/users/r0ss26/)
 * (@r0ss26)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/update-database-automatically/)
 * Is there such a way to update the database automatically every 12 months after
   a participant has created their record? For example I want to increment a field
   by 1 every 12 months.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/update-database-automatically/#post-11448741)
 * There is nothing in the plugin that will do this. Perhaps if you described what
   you need this for, we can figure out the best way to do it.
 *  Thread Starter [r0ss26](https://wordpress.org/support/users/r0ss26/)
 * (@r0ss26)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/update-database-automatically/#post-11448841)
 * I have a column in the participants database with the heading “years since PhD
   completion” and I want this to increment yearly after the user has added their
   record into the database.
 * I tried the custom template route and was able to get it do the calculation and
   display the correct value but then ran into a few problems.
 * Firstly I need it to work with the multisearch plugin and secondly I need the
   user to be able to sort by this column. i.e. to sort by increasing or decreasing
   values in this field.
 * I feel like the best way to do this would be to update the actual value stored
   in the database but not sure if this is really the best way or if it’s possible.
    -  This reply was modified 6 years, 11 months ago by [r0ss26](https://wordpress.org/support/users/r0ss26/).
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/update-database-automatically/#post-11450157)
 * Writing the new value to the database is certainly the way to go here.
 * Something like this is a bit complex in that it requires the use of a “cron” 
   that will run on a schedule in the background. When it runs, it will check your
   records and update any that need it.
 * There are plugins that can make this easier, such as [Cronjob Scheduler](https://wordpress.org/plugins/cronjob-scheduler/),
   but it does require you to write the code that will be executed on schedule.
 * I have also written a tutorial on setting up cron jobs with Participants Database…
   it’s for a different purpose, of course, but if you understand the code, it would
   be easy to use it as a template for your own custom code.
 * [Automatically Sending an Email using the WordPress Cron](https://xnau.com/automatically-sending-an-email-using-the-wordpress-cron/)
 *  Thread Starter [r0ss26](https://wordpress.org/support/users/r0ss26/)
 * (@r0ss26)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/update-database-automatically/#post-11453029)
 * So I’ve downloaded the cronjob scheduler plugin, would a script like the following
   work if it was run every day?
 * [https://github.com/r0ss26/acuads_wordpress_cronjob/blob/master/cronjobs.php](https://github.com/r0ss26/acuads_wordpress_cronjob/blob/master/cronjobs.php)
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/update-database-automatically/#post-11454867)
 * Looks about right. One possible problem would be the way you’ve set up your conditional,
   it will only update the record on the one day that is an even multiple of 365
   from the day the record was created. If your site gets daily traffic, that probably
   won’t be an issue, but on a site with low traffic it’s possible the cron won’t
   run every day, and an update could be missed.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Update database automatically’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/update-database-automatically/#post-11454867)
 * Status: resolved