RE: Automatically update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are a couple of ways to do this:

1) The first is to use a scheduled program executor like cronjobs (in Linux)
and scheduled tasks (in Windows).  These utilities execute a given file at
set intervals or at pre-programmed dates and times.

Though written for cpanel users, I found this tutorial helpful understanding
how to use cronjobs with php scripts:
http://www.trap17.com/index.php/cron-jobs-cron-jobs-cpanel_t6321.html

I typically use a single script that runs at set intervals that checks the
database for tasks that are due to be executed, rather than having a lot of
entries in cronjob.  I chose this method because I can give a client control
over which 'jobs' execute and when by changing parameters on a form which
then changes the parameters in the database.

2) In some cases, where appropriate, and with later versions of MySQL,
'events' can be created in MySQL and MySQL will execute these events
automatically.  Events are similar in their construction to other stored
procedures.  Events are associated with a single table.  This works very
well for deleting expired sessions or cleaning up old unused records.  It
may not be useful is complex processing is needed to do table updates.

Here are some links to learn how to write events:

http://dev.mysql.com/tech-resources/articles/mysql-events.html
http://www.phpied.com/mysql-events/

I believe it is usually better to have MySQL do the work than to have a PHP
script running for server load and speed.

I hope this helps.

Gentlemike2


  -----Original Message-----
  From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx]On
Behalf Of Gab Teo
  Sent: Saturday, March 27, 2010 3:10 PM
  To: php-objects@xxxxxxxxxxxxxxx
  Subject:  Automatically update



  I'm looking for a way to modified an update php script and to set it in a
way to automatically update my database every 2 hours, can any one help or
advice?

  Gab

  [Non-text portions of this message have been removed]



  


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux