0

I have a MySQL database in which I have to update a certain field weekly.

Once the user lands on a particular page on my website on a Wednesday, it will need to check the current date.

If the day lands on a Wednesday then all records containing value a will be reset to value c, but all records containing value b will remain as they are.

This process can be run only once on the Wednesday. Afterwards the user will be able to freely input either value a or b until the next Wednesday.

How would this be accomplished in PHP/MySQL? I would appreciate any pointers in the correct direction.

0

2 Answers 2

3

If you have permission on the server (or can get it setup some other way), your best bet would be a cron job (assuming your server is on Linux).

http://en.wikipedia.org/wiki/Cron

http://community.contractwebdevelopment.com/cron-job-mysql

Sign up to request clarification or add additional context in comments.

1 Comment

do you have control over the server on the network? is it Linux? cron is built into Linux. doesn't really have much to do with the web application or database. it can be used for anything that you want to do at a specific interval of time.
2

The usual way to do this is to run a weekly cron job at some ungodly hour where it won't disturb anybody. Don't rely on users visiting websites to do regular tasks.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.