Home  >  Article  >  Backend Development  >  插入数据库时当多表关联时,似乎不大好办解决办法

插入数据库时当多表关联时,似乎不大好办解决办法

WBOY
WBOYOriginal
2016-06-13 10:12:25758browse

插入数据库时当多表关联时,似乎不大好办
比如

a表 b表

insert into a('text') values('hello'); id primary asc

然后产生一个自增id编号,然后要将这个id存入 b表,

似乎可以用mysql_insert_id()

但是如果同时很多人操作,那么就不知道什么情况了,

因为有的人说没关系的,但是也没人具体做实验啊。


所以说可能有“隐患”,有没有什么方便的方法


------解决方案--------------------
mysql不是支持事务的嘛
------解决方案--------------------
http://www.360doc.com/content/11/0524/16/987036_119061400.shtml.
这个人,给了你什么
------解决方案--------------------
程序端多检测下。操作的话mysql的事务处理操作。或者ajax检测!
------解决方案--------------------
你这是杞人忧天,可以负责任的告诉你,不存在你担心的问题

------解决方案--------------------
就是嘛。不必担心的,再多人都有一个列队的,有先来后到的。

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