Page 1 of 1
SQL update timed?
Posted: Sun Sep 30, 2007 12:34 pm
by Blackmirth
How is it possible, if it is, to make the contents of a MySQL table/cell/column whatever update every say... twenty minutes?
Sorry if this is quite a stupid sounding question. I am new. Ignorance is my excuse.
Posted: Sun Sep 30, 2007 1:08 pm
by feyd
Cron.
But the question of what are you trying to do must be asked.
Posted: Mon Oct 01, 2007 2:43 am
by Josh1billion
Create a PHP file which executes the update queries you need. Then, like feyd said, use Cron Jobs (in your control panel) to have that PHP script run every twenty minutes.
Posted: Mon Oct 01, 2007 11:47 am
by Blackmirth
feyd wrote:Cron.
But the question of what are you trying to do must be asked.
Not really trying to do anything, really. It was more curiosity really.
Although I am sure it will come into use.
I have never heard of Cron before, or at least only as a misspelling of corn. I also cannot find any option in my hosts' panel.
Would there be any alternative to this?
Posted: Mon Oct 01, 2007 12:21 pm
by s.dot
Google "cron jobs" or "crontab". It's a *nix software. If your host is windows, you'll have to use the windows task scheduler.
Posted: Mon Oct 01, 2007 12:59 pm
by Blackmirth
Thanks. Although, surely if I am running it, that would mean keeping my computer on all the time?
Posted: Mon Oct 01, 2007 2:23 pm
by feyd
Something to remember is that if the results of this information doesn't need to be done on a regular basis, there's no need for a cron script. Instead the functionality could be incorporated into existing site code.
As an example, a user wished to update data about who was online at his website every few minutes. The problem was, this information was only potentially useful if someone was looking at it (on a single page.) So instead of setting up a cron job, they could have simply told the page to fetch the data on-demand.
Posted: Tue Oct 02, 2007 5:54 am
by malcolmboston
i actually do what feyd is talking about on a popular eCommerce site, and its not a trivial function such as updating a whoisonline script but a very important site function.
Although i will say, it is important to lock the table if you are doing something of this kind, or locking the file your working as i do, otherwise it can (and will) cause problems on concurrent connections.
Good luck