It seems difficult to solve the problem when multiple tables are joined during Database insertion.

Source: Internet
Author: User
When a database is inserted, when multiple tables are joined, it does not seem easy to do. for example, in Table a, Table B, insertintoa ('text') values ('Hello'); idprimaryasc then generates an auto-incremental id number, then I want to store this id in Table B. It seems that mysql_insert_id () can be used. However, if many users operate on this id at the same time, I don't know what the situation is, because when multiple tables are associated during Database insertion, it does not seem easy to handle
For example

Table a and Table B

Insert into a ('text') values ('Hello'); id primary asc

Then an auto-increment id number is generated, and the id is saved to Table B,

It seems that mysql_insert_id () can be used ()

However, if many people operate at the same time, they do not know what the situation is,

Some people say it's okay, but no one is doing experiments.


Therefore, there may be "hidden risks" and is there any convenient method?


------ Solution --------------------
Mysql does not support transactions.
------ Solution --------------------
Http://www.360doc.com/content/11/0524/16/987036_119061400.shtml.
What did this guy give you?
------ Solution --------------------
Multiple programs are detected. Mysql transaction processing. Or ajax detection!
------ Solution --------------------
You are worried. you can tell you responsibly that there are no problems you are worried about.

------ Solution --------------------
Yes. You don't have to worry about it. there are more than one person in the queue.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.