Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.