How to create an associated MySQL table-what you usually see is a single-table-operated book video or something.

Source: Internet
Author: User
Tags open source cms
How to create an associated MySQL table-what you usually see is a single-table-operated book video or something.
PHP has been learning not to progress, recently saw a few open-source things, and then have dynamics.

Always read the book Ah, video AH is the operation of a single table.
Now to implement a function is to record some open source CMS data table field names and tables.
For example, I want to record all the tables in the Ecshop, and record the field names and types of each table and write them to the database and save them.

Like this, so this database I was designed to, two of tables.

First table one (record table information, tabid associated with the second table of Tid)
Auid Int (3) Self-increment, primary key
TabName varchar (30) Name of table
Tabnote varchar (note of the table)
TabID Int (3) is associated with the TID in the table
Addtime Int (10) timestamp for adding a table


Second table two (Record table field information)
Auid Int (3) Self-increment, primary key
Tname varchar (30) field name
Ttype varchar (20) field type
Tnote varchar (100) Description of the field, note
Tid Int (3) associates the tabid of the first table one

==========================================
So how to set up the database when the automatic association, I just do not know how to achieve, such as now I insert a piece of data
Table Name: Article_cat
Table notes: Article Classification information
Table added time: 1395052170
Field: Type
Field type: Time
Field Description: This is a timestamp

-----------------------
So how do I insert a database after I accept the message via post?

Insert INTO ...

Is there a problem with the design of my table above, whether the table-related fields must be the primary key or something like that?

------Solution--------------------
The first table auid and tabid are repeated, using one on the line.
There's no auto-correlation. You have to write the data in the associated field.
  • 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.