
July 26th, 2007, 07:30 PM
|
|
Contributing User
|
|
Join Date: Apr 2007
Location: New York
Posts: 1
Time spent in forums: 27 m 18 sec
Reputation Power: 0
|
|
|
Locking records in a multi user system
I wrote a sort of message board for the office; in php / MySQL.
It consists of "items" and "comments". (It's like threads and responses.)
Everybody is allow to edit the text of any existing "item" or " comment". (This is as specified by the powers that be.)
My problem is locking a record while it is being updated.
I added a timestamp and current user field to the database.
When a record is selected for update, the timestamp and current user fields are filled in, and the record is "locked". When the user saves his update, the timestamp and current user fields are cleared, and the record is available to edit again.
There is a 5 minute rule that automatically clears the timestamp & user field, in case the record is abandoned without saving.
So.... here at last is my question...! Is there any way to detect when a user has left a record and moved on; so I can free up the "locked" record.
|