Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto update with PHP/MySQL

Status
Not open for further replies.

UnclearHorizon

Programmer
Joined
Oct 23, 2001
Messages
8
Location
US
Is it possible to have an PHP page or just a MySQL database update itself at a certain time? like every hour it adds 1 to a counter or sumthin so my page knows how many hours its been since i reset the value in the database...if thats hard to understand, ill try to rephrase it just reply that its hard to understand
 
can i maybe do this through Cron Jobs? or is that just for cgi?
 
I'm not an expert in PHP or Cron jobs, but here's how I would do it:

create a command-line executable php script with the following at the top:

#!/usr/local/bin/php -q //modify if php is located elsewhere
<?
//put php script here to connect to db, insert new record and close connection
?>

Then execute it as a cron job once an hour. Make sure to chmod the file to make it executable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top