Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm using PHP 4.3.4 and MySQL 5.0.37 with InnoDb tables and am venturing into using transactions.
If I'm using transactions, do I need to worry about table/row locking in order to prevent multiple users from updating a given record at the same time?
I can think of two scenarios:
1) The DB holds a 'next request' counter. Client A and B both open the page that uses this counter. The pages read and increment the 'next request' counter. I don't want both clients to end up with the same counter value. Will MySQL prevent this if I put the update/read statements inside a transaction?2) The second situtation is were two users are updating the same db record. Both have read the record to a webpage, they each take X minutes to modify the record and then submit the changes. Even if transactions/locks would handle this, I don't want to keep the record locked for X minutes, so I imagine the way to handle this is to use a timestamp to know if the record has been updated since read. Or would the normal way be to keep the record locked during the editing time period?

![]() |
PHP/MySQL include
|
Session End Cleanup Probl...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |