Re: locking a mysQL row
| From: | tjacobs-php at codegnome dot org | Date: | Tue, 11 Sep 2001 04:41:17 +0000 |
| Subject: | Re: locking a mysQL row | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66846@lists.php.net to get a copy of this message | ||
On Tue, 11 Sep 2001, Justin French wrote:
> I'm currrently developing a dynamic, user-added content site. The
> thing is, content can be added and edited my TWO people.. the
> original writer, and the editor.
Just put a timestamp field into the table, which will automatically track
the last update of that row. Prior to doing a write, lock the table, and
then compare the timestamp at retrieval time to the current timestamp. If
it's identical, write the data and unlock. Otherwise, display an error and
unlock, or do whatever else you want to do to handle the error.
--
Work: It's not just a job, it's an indenture.