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

PHP MYSQL事宜会并发吗

WBOY
Release: 2016-06-13 13:21:37
Original
874 people have browsed it

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

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

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

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

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



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

探讨

用select ... for update
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template