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 SkipVought 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
Oct 23, 2001
8
0
0
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
 
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