Thank you everyone who replied to my problem. I have decided now to go with
Anna's solution and so far it's working great!
So thank you very much for your help Anna.

Thanks again,
Andy.

-----Original Message-----
From: anna w [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 01 December 2004 11:17
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Multi-User Update Problem


Hi Andy

Users will always leave browsers open with 'locked' records & go
home/to a meeting/ power down, so don't prevent access to locked
records.  In fact don't lock them unless you really have to.  Maybe
this would suit you better...

Add a timestamp to the relevant tables.  Add it to the primary key index.
Always retrieve the timestamp and write it to a hidden field in the
html update form.
When they click save:
    Select the timestamp from the db based on the primary key (index
covered so should be fast).
    If it matches the one sent from the form you're safe to do the update.
    Else redisplay the form (fresh record from db including fresh
timestamp) with message "Changes could not be saved as this record has
been updated since you displayed it."

If the message causes upset then start saving the name of who updated
the record along with the timestamp, and displaying it with the
message.  Then the users can blame each other instead of you, and
they'll quickly learn not to leave half-finished work when they go to
lunch ;)  Or if it's not a small community then display the time they
originally selected the record - you get the idea.

hth, hope it made sense!
Anna

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to