Code Comments
Programming Forum and web based access to our favorite programming groups.Its a tough one. My personal fav is to mark the record as locked by changing a field called 'locked' from 0 to 1. Check for this when extracting the record and if is present, alert the user this record is locked (if you want to get fancy you could even track who locked it and the tell the user that) and show a non-updatable form of the page (either with the fields as readonly or by creating some kind of view only page where the data is simply echoed out). If you want to get REALLY out there, you could track who requested the locked record and notify them when it was released(by the original requestor submitting the form). The possibilities are endless The other option is to create/write an entire concurrency module that will store the record in a separate entity (another table or session object) and then compare any changes made upon submission. I have seen this but I don't really like it, since the ultimate choice is left to the user as to what data is correct. Bastien >From: "SCALES, Andrew" <Andrew.SCALES@eur.crowncork.com> >To: php-db@lists.php.net >Subject: [PHP-DB] Multi-User Update Problem >Date: Mon, 29 Nov 2004 11:16:08 -0000 > >Hello, > >Does anyone know a good way of locking out access to a record on a MySQL >database when someone has the update page open? >The problem is that we have a local intranet site which is accessed by >members of different departments. Now at the moment when someone loads the >page all of the data is pulled into the form, and then when they submit, >all >of that data is passed back to the database, including anything they >haven't >changed. > >What we are trying to avoid is situations where for example someone leaves >the form open on their computer and goes away for lunch. In the meantime >someone else at a different station makes changes to the form. Then when >the >first person comes back from lunch, they submit the form, thereby writing >over all of the second person's changes with the old data. > >Does anyone know of a good way to solve or work around this problem? We >have >thought about setting a flag on the database whenever someone pulls down >the >data, however if their browser crashes or they shutdown with the window >open >then this is going to leave the data locked. > >Thanks very much, > >Andy > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.