Jump to content

Recommended Posts

You can use [url=http://dev.mysql.com/doc/refman/5.0/en/transactional-commands.html]transactional and locking statements[/url] if you need atomicity over multiple SQL statements (a transaction).  Otherwise, for a single query, AFAIK, queries are "atomic" by nature.

Of course, I'm refering to SQL commands which change a table in some way (UPDATE, INSERT, or DELETE).  SELECTs would be exempt.

MySQL (I'm assuming MySQL since you're posting in this forum, otherwise PostGRE, Oracle, whatever) handles the database functions.  If a PHP with a table-altering SQL query is requested once, then immediately requested by another user, the inital SQL is carried out, then the second request "sees" the updated table.

Does that answer your question?  There's plenty of information out there on database concurrency, atomicity, transactions, etc.  Much of it is database developer theory and is not of the database user's concern.
Thank you for ur quick response ;)

and what about this:

<?php
//call query to add 1 to some field
//call query to substract 1 to same field
?>

User 1 requests
User 2 requests

can this happen:
u1 add
u2 add
u1 sub
u2sub

or

u1 add
u2 add
u2sub
u1 sub

this can cause inconsistance if you are not using increment or decrement but getting values, changing them and then putting them
so are those queries in 1 php page 1 thing? cause i'm still not getting that part :)

thanks!
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.