Home  >  Article  >  Backend Development  >  PHP MYSQL事宜会并发吗

PHP MYSQL事宜会并发吗

WBOY
WBOYOriginal
2016-06-13 10:33:47898browse

PHP MYSQL事务会并发吗
假如有A表和B表。

向B表插入数据的前提是先判断A表。

如果在程序上先判断A表,然后再进行插入数据就发生了并发。。

如果做成事务,插入数据以后再去判断A表,如果条件不符,再回滚。。。  

这样能解决么,好像还是会并发?



------解决方案--------------------
用select ... for update
------解决方案--------------------

探讨

用select ... for update
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn