MYSQL multi-table join insertion data problems, please help, dead...
Source: Internet
Author: User
MYSQL multi-table join insertion data problem, please help, anxious ...... I inserted A piece of data in Table A, where the ID field automatically grew, and then I used mysql_insert_id (); to obtain the ID of the data just inserted, then insert several pieces of data into Table B using the FOR loop. the ID of Table B is the problem of using mysql_inser MYSQL multi-table Association to insert data ......
I inserted A piece of data in Table A, where the ID field automatically grew, and then I used mysql_insert_id (); to obtain the ID of the data just inserted, then insert several pieces of data into Table B using the FOR loop. the ID of Table B is obtained by mysql_insert_id ();, and the program appears at the beginning of internal testing, the ID of the data inserted into Table B of employee a Becomes the ID of the employee, which is confusing. please give me an idea how to solve this problem, the ID of Table A is the same as that of Table B. thank you ......
------ Solution --------------------
This problem may occur during concurrency. use transaction. if transaction is not supported, use the lock.
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