RE: Multi-User Update Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux