Concurrency in a multi-user environment

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

 



Hi,

I'm been googling to see if I can find information on how programmers handle 
concurrency in a multi-user PHP/MySQL environment.  Here's a snippet of my 
app.

I have a form where users can maintain client information such as Name, 
Address, telephone, email, etc....  I've been wondering how to handle a 
situation where two users are editing the same record.

One idea is to lock the record when User A enters but this may make it 
inaccessible for a long period if User A decided to get up and leave for a 
three hour lunch.  Also, does locking a record prevent file locks (when new 
records need to be added)?  Finally, locking a record means I have to 
convert from MyISAM to InnoDB but this is probably necessary for 
concurrency.

Another idea is to use a semaphore where User A enters and retrieves a 
numeric field in the table.  Upon leaving, the user locks and checks if the 
field is the same value. If yes, save, increment the numeric field and 
leave.  If not, it indicates another user entered has edited, saved and 
left.  I'm not crazy about this as it would mean User A could spend 15 
minutes updating a record only to get a message that User B already edited 
it.

Does anyone have any user friendly suggestions or can give me some URLs 
where I can read up on this?

Thanks,
Don 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux