|
|
mysql RSS Feed
View Chantal's IsPopularOnLine RSS Feed
MYSQL PHP update queries with locking can be rewritten as below :
$query = "LOCK TABLES table1 WRITE, Table2 WRITE";
mysql_query($query);
$query = "UPDATE table1 SET table1_id = 21 WHERE table1_id = 3";
mysql_query($query);
$query = "UPDATE table2 SET table2id = 10 WHERE table2id = 3";
mysql_query($query);
$query = "UNLOCK TABLES";
mysql_query($query);
Immediately after issuing the LOCK TABLES MYSQL directive, all other users are blocked from reading and writing to the tables specified. So the update or delete query will continue to completion without any worries that the intended table gets changed by another user while your transaction is in process.
Super locking Specials at Amazon.com Everyday!
| 05/09/2007 03:47 PM |
| Locking Unlocking MYSQL Tables Transactions using PHP script code |
|
MYSQL PHP Table Locking
MYSQL PHP Lock ON OFF Script Code Snippit Example
MYSQL PHP update queries with locking can be rewritten as below :
$query = "LOCK TABLES table1 WRITE, Table2 ...
|
comments