Skip to content
Advertisement

Reset to default value depending with the year

I want to automatically reset the value in hours_remaining to its default value according to year. I also want the year to auto-incremented. Can anyone give me some advise or help on how to implement this? By the way I’m new to using Php MySql.

From this:

JavaScript

To this when another year:

JavaScript

Advertisement

Answer

This is the perfect use of MySQL’s EVENT, which can perform periodic jobs. Just make sure the event scheduler is toggled on. Then create a event and watch it happens:

JavaScript

Of course you are not going to wait another 8 months to find out. To test it, you can just change the time to every 60 second starts now()

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement