php如何锁定表读写?这是我在没有运气的情况下尝试过的方法。
mysql_query("LOCK TABLES table WRITE;");
mysql_query("LOCK TABLES table READ, WRITE;");
mysql_query("LOCK TABLES table READ WRITE;");
这是我得到的错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WRITE' at line 1
最佳答案
mysql_query("LOCK TABLE table WRITE"); // you might think it's here
mysql_query("LOCK TABLE table READ, table AS t2 WRITE"); // <- but the error is here
mysql_query("LOCK TABLES table READ, table as t2 WRITE"); // <- ...and here.
如果没有别名,您不能为同一个表获取多个锁。 Read the manual .
关于php - 锁表读写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7981688/