PHP Operational Database related issues

Source: Internet
Author: User
PHP Operational Database Issues
Problem:
There are two tables: Table1,table2
The fields in the Table1 are:
ID Title Content

The fields in the table2 are:
ID CID User

Where CID is the ID in table1

Table1 When you generate a data by insert into and write the ID in table1 to table2, how do you do that?

As follows:
Table1:
ID Title Content
1 Test Content
2 Test2 Content 2

Table2:
ID CID User
1 1 Users
2 2 users 2


Thank you ~



------Solution--------------------
MYSQL_INSERT_ID ();
Get the ID from the previous insert operation and insert the Table2
  • 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.