Hi Raditha,

I'm not sure table locking is the answer. I'm not talking about concurrency
in the sense of 'simultaneous' updates and selects, but in the sense of an
'open record edit session' that predictably will overwrite the value of a
record that may have been changed, after the edit session began, but before
the edit session is committed.

So, User A clicks on an edit link on a page which retrieves that record's
content from the db, and begins editing.

User B performs a page rename, which enacts an update similar to:

UPDATE mytable set content = replace(content, 'old val', 'new val') where
content like '%old val%'

User A finishes his or her page edit and commits the changes, but the
underlying record was already changed by User B's page rename. User A's edit
changes overwrite this update in the record in question, and now that record
still shows 'old val' instead of 'new val', since that was what was in the
content when User A began editing the page.

I'm just wondering how others go about handling these circumstances. One way
I can think of is to have a 'beingedited' field in the table, and to update
this to a 1 when a user requests a page edit, and set it back to 0 when a
user commits the changes, and then to check whether or not any of the rows
affected by the page rename are currently 'locked' (beingedited=1). Still,
this doesn't account for the possibility that a user might request a page
edit, 'locking' the record, and then simply navigate to some other page, or
close their browser etc, thus leaving the record locked. 

I'd be surprised if others hadn't encountered this issue previously?

Much warmth,

Murray


-----Original Message-----
From: raditha dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 12 October 2004 2:27 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Best practise for resolving potential conflicts when
editing db content?

Murray @ PlanetThoughtful wrote:

>Hi All,
>
> 
>
>I'm developing a wiki-esque application for an in-house project and am
>wondering how others go about resolving potential conflicts when multiple
>users are editing the same content drawn from a MySQL database?
>
>  
>
You might want to ask in a mysql group about table locking.

-- 
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

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

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

Reply via email to