Computing.Net > Forums > Web Development > php/mysql & transaction question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

php/mysql & transaction question

Reply to Message Icon

Name: Don Arnett
Date: May 23, 2007 at 15:14:40 Pacific
OS: na
CPU/Ram: na
Product: na
Comment:

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?



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


PHP/MySQL include Session End Cleanup Probl...



Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: php/mysql & transaction question

php & mysql hosting www.computing.net/answers/webdevel/php-amp-mysql-hosting/3347.html

How do I setup PHP & MySQL on XP www.computing.net/answers/webdevel/how-do-i-setup-php-amp-mysql-on-xp/122.html

PHP, MySQL, phpMyAdmin www.computing.net/answers/webdevel/php-mysql-phpmyadmin/1590.html