Good Morning,

I am hoping someone can help me. I am not even sure if this is possible. I am building a hockey pool site and I would like to automatically update the value of a variable once a week or 26 times. I would like to use the clock on the server and not the users machine.

I know this is not the proper code but this is what I would like to do:

<?php
$a="1A";
AS OF THURSDAY OCTOBER 7, 2010 AT 19:00 EST $a=$2A;
AS OF MONDAY OCTOBER 11, 2010 AT 19:00 EST $a=$3A;

ETC, ETC, FOR 26 WEEKS
?>

I have a few of these to do, but once I figure out one the rest will be easy.
Anybody have any suggestions?
Thanks in advance!

Member Avatar for Zagga

Hi ceeandcee,

to run code at scheduled times you need to create either a cron job (unix server) or a scheduled task (windows server).

This will automatically run your code at whatever interval you choose (every Thursday, or 2pm on the 23rd of each month or whatever you like). The code that it runs can then adjust the variables however you need.


Hope this helps.
Zagga

Thanks Zagga...any suggestions on where I can read up to learn how to do that?

Member Avatar for Zagga

hi again,

You need to find out if you have a unix or a windows server first.
Then, if you use some sort of web interface to access your website, see if there is an option to set it up in there (for example, I have a unix host and have a cpanel to access lots of features. There is an option to set up cron jobs in there).

If you don't have anything like cpanel, you may have quite a bit of googling to do.


Zagga

commented: Thank you! +1

Perfect! I think it is a windows server and I can see something in my cpanel about Scheduled Tasks. I will send my host a note to look for some guidance on how to set this up.

I appreciate your help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.