How do I reset a column in my database every x days?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
chicago123
Forum Newbie
Posts: 5
Joined: Sat Mar 08, 2014 10:24 pm

How do I reset a column in my database every x days?

Post by chicago123 »

I am a PHP beginner.

Every x days (every 7 days for example), I would like all the values in a certain column in my MySQL database to reset back to '1'. How do I do this?

Please note: My web host does NOT have the MySQL event scheduler enabled so that is not an option. Also, my web hosting plan does not allow me to do cronjobs so that is not option either. Any other ideas?

Thanks!
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: How do I reset a column in my database every x days?

Post by Celauran »

Schedule a cron job somewhere else. Write the script that will update your DB then call it via cURL or something from somewhere that does support cron or similar.
chicago123
Forum Newbie
Posts: 5
Joined: Sat Mar 08, 2014 10:24 pm

Re: How do I reset a column in my database every x days?

Post by chicago123 »

Ok thanks, that worked!
Kathleen201
Forum Newbie
Posts: 1
Joined: Wed Apr 02, 2014 9:52 am

Re: How do I reset a column in my database every x days?

Post by Kathleen201 »

If your hosting provider doesn't allow setting cronjobs, there are some services, that will allow cronjob up to for free, like easycron.com.
Post Reply