I could use some practical tips on doing transactions with InnoDB tables in MySQL.
I want to grab and lock a record and do a whole load of related stuff, then make sure everything is updated in a consistent way, something like this skeleton: BEGIN SELECT * from blah WHERE something=n FOR UPDATE //Grab and lock a record SELECT * from t1, t2 where a=1 ... INSERT blah... UPDATE something else... if ($allok) COMMIT else ROLLBACK I don't quite get what I need to do to make sure these are all regarded as part of the same transaction. Does the transation apply to all queries made between the begin and commit (I assume so)? What happens when I have another process doing the same thing at the same time? Do I need to keep the result value I get from the begin query and somehow use it for the commit at the end so MySQL knows they are two ends of the same transaction? Or does MySQL somehow track that for me - i.e. can there only be one transaction in progress per connection? I'm finding the MySQL docs are extremely dry and somewhat short on examples... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php