MySQL Multiple table association insert data about the problem, please master help, dead ...

Source: Internet
Author: User
MySQL Multi-table association to insert data problems, please master help, anxious to die ...
I insert a piece of data in table A, where the ID field is autogrow, then I use mysql_insert_id (), get the ID of the data just inserted, and then insert a few data into table B with a For loop, and the ID of Table B is just the mysql_insert_id (); Obtained, the program has just started the internal testing of the company has appeared, the staff of the Insert B table of data ID how to become an employee ID, chaos, please help out an idea, how to solve this problem, to a table ID and B table ID is the same, thank you ...

------Solution--------------------
This problem may occur when concurrency occurs, please use transaction, if you do not support transaction, use the lock
  • 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.