Re[2]: [PHP] using crone to check database
| From: | Richard Kurth | Date: | Wed, 13 Sep 2000 04:12:06 +0000 |
| Subject: | Re[2]: [PHP] using crone to check database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16490@lists.php.net to get a copy of this message | ||
>> I would like to use crone to check my database about every 15 min to
>> see if a new entry has been but in. Could somebody give me some
>> suggestions on what is the best way to determine what is new in the
>> database and what has already be checked the last time crone was run.
JM> I suggest either:
JM> a) adding a field to the database which stores the current timestamp
JM> upon insertion. This could be an integer field containing the result
JM> of Date("U"), or if you're using MySQL a timestamp field which will
JM> automagically take the current YYYY-MM-DD HH:MM:SS value when a NULL
JM> is inserted into it. This way you can select all records where the
JM> timestamp is greater than 15 minutes ago.
JM> b) store the number of rows in a file. Have your script read this number,
JM> and then decide based on COUNT(field) is anything's new.
Jason
The first on was the way I was thinking of doing it. I wasn't sure
if it was the best way.
Thanks
Richard