Torsten: Thank's a lot, I think I get it!

> Hi Norma,
> you can achieve this in a much more comfortable and elegant way:
> Create an integer column named oca (stands for Optimistic Concurrency
> Control Attribute). When you load the data to show them in the editing
> store the value in a hidden field or in the session (if you are using
> sessions). Then when you update the data use the following statement:
> UPDATE table SET column = '$value' ..., oca = oca + 1 WHERE user_id =
> $user_id AND oca = $value_from_hidden_field
> After performing the query check the affected rows. If there is one
> row the update was succesful. If there are no affected rows it means that
> someone else updated this row in the meantime (thereby incrementing oca)
> you can show a message like:
> "Since the start of your editing process someone else updated this record
> set. Please cancel and edit the record again."
> This way you will never lock out a record set forever like Miles wrote and
> the user will at least be able to "open" the record set and see all data -
> even if sometimes (should be very seldom) he has to cancel and start
> I hope you get my point - it's a bit difficult to explain.
> Best regards, Torsten Roehr
> -- 
> PHP Database Mailing List (
> To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to