Php advanced implementation of unlimited Classification 2

Source: Internet
Author: User

2. database Planning -------------------------------------------------------------- as we talked about the complexity of classification, it is very important to plan a database to implement unlimited classification. I have introduced the Database Planning of the Forum. Good news is that the Forum can achieve unlimited follow-up, and unlimited classification is an extension of this form. Classification is also a parent association, therefore, the classification database is how to establish the parent relationship clearly. There are several difficulties. 1) how to store information of various categories; 2) how to process kinship of different categories; 3) How to query information; the process of relational databases is similar to that of Forum databases, here we create a type database for processing classification: Create field: id (int): used to record the natural serial number uid (int) of each classification ): id of the parent category used to record the category type (char): category name roue_id (varchar): kinship tree, with: 0: 2: 10: 20: the id connection indicates the relationship between the source and source roue_char (varchar): kinship tree, similar to: System: linux: Development Tool: gcc: (whether this field does not matter, to make it easier to understand the kinship, of course, the character expression is more direct than the numerical expression ^ o ^, but it is best to add this field) This is an infinitely classified Category Table, next, you need to create a database to store information. It is most convenient to process and query a table. Here, you need to create a table Storage information: type_message: id (int): Information serial number; typeid (int ): id of the category; title (varchar): Information title; message (text): Information Content; time: information creation time; the two data tables can complete the infinite classification task (the auxiliary fields of the two tables are not added, and readers can add them themselves ). all the remaining tasks are handled by php.

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.