Reputation: 383
I want to create a PHP script, which would be launched regularily as a cron job. But sometimes I may launch it manually. The script must modify MySQL rows created from the time of its last execution and I want to avoid modifying the same row twice. Each row contains its creation time. I don't want to clutter my database with a whole column to hold last modification time for each row.
To narrow the problem down, I need a variable $last_execution_time
to hold a timestamp, written on the last script execution.
What is the correct and elegant way to do this?
Upvotes: 0
Views: 297
Reputation: 26153
You can write time to file.
When script is running, lock the file, to avoid the simultaneous calls problem
Upvotes: 1
Reputation: 1
Pull out the last known record from the DB.
Select lastupdatetime from table limit 1 order by id desc
Make a check to see if it's before current time stamp etc
So use the data in the database to help yo
Upvotes: 0