Jump to content

mysql write conflicts with concurrent connections


ajetrumpet

Recommended Posts

Hi all,

 

Yet another question for the experts here.  As in the subject to this thread, I'm interested in finding out how PHP handles concurrent database connections when the script has a write operation in it.  like for instance, this code:

 

$sql = "UPDATE table1 field = 'new value' WHERE field = 'old value'";
mysql_query($sql) or die('Update Failed!');

 

if I have 10 people loading one of my pages at the same time and I'm updating the same database table (with different records for each user) with an update statement, am I risking errors or even corruption because of the write-conflict issue??

 

It seems to me that PHP would act somewhat like an operating system here and sequence the requests so that doesn't happen.  True?

 

thanks so much!

This isn't handled by PHP, but the underlying database engine. For MySQL you can check out these links.

http://stackoverflow.com/questions/2217106/concurrent-mysql-database-queries

http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html

 

I'm sure, when moved to the correct section, that the resident MySQL expert(s) can fill out on whatever info I'm missing.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.