0

Say I want an action to be performed on my database every so often such as add a random number of "points" to a random entry in a table every time it iterates. I want this to happen even if nobody visits my site. If this is possible with PHP could you please explain this to me, if not, how is this possible. I would prefer it all be server-side that way there are no outside variables involved.

Thank you for your help.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by rch1231
0

Hi fuggles,

If you want it to be fully automated, you will need to look into either "Cron Tab" if your server runs Unix, or "Scheduled Tasks" if your server runs Windows.


Hope this helps.
Zagga

0

If you are on a linux server then the easiest way is to write the mysql or php code to perform the action and then call it from cron. cron will run jobs at a specific date, time, or day of the week based on what you set up.

Calling a php script to run the first of the month at 10 after midnight you add an entry like this to cron:

10 00 1 * * /usr/bin/php /path/to/your/cron.php

to verify where our php executable is from a command prompt type:

which php

to edit your crontab from a command prompt type:

crontab -e

As far as the script to do what you want we would need more detail on the tables involved and calculations.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.