RE: [PHP] using crone to check database
| From: | Jason Murray | Date: | Wed, 13 Sep 2000 05:19:15 +0000 |
| Subject: | RE: [PHP] using crone to check database | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16488@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.
I suggest either:
a) adding a field to the database which stores the current timestamp
upon insertion. This could be an integer field containing the result
of Date("U"), or if you're using MySQL a timestamp field which will
automagically take the current YYYY-MM-DD HH:MM:SS value when a NULL
is inserted into it. This way you can select all records where the
timestamp is greater than 15 minutes ago.
b) store the number of rows in a file. Have your script read this number,
and then decide based on COUNT(field) is anything's new.
Jason