Home >Backend Development >PHP Tutorial >PHP advanced implementation of unlimited classification 2_PHP tutorial

PHP advanced implementation of unlimited classification 2_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:28:12979browse

2. Database planning------------------------------------------------ --------------- We talked about the complexity of classification earlier, so how to plan the database has become a very important step to achieve unlimited classification. I have introduced the database planning of the forum. It is good that the forum can To achieve infinite connections, infinite classification is an extension of this form. Classification is also the relationship between children and parents, so the classification database is how to establish and clarify this relationship between children and parents. There are several difficulties in this. 1) How to deal with it Information storage for each category; 2) How to deal with the kinship of the category; 3) How to handle the query for information; The database processing of kinship is similar to the database processing of the forum. Here, a type database is built to process the category: Create fields: id (int): used to record the natural serial number of each category uid (int): used to record the id number of the parent category of the category type (char): the name of the category roue_id (varchar): affinity tree, with: 0:2 :10:20: The id connection indicates the parentage relationship roue_char (varchar): parentage tree, similar to: system: linux: development tool: gcc: (It doesn’t matter whether this field is present or not. In order to more conveniently understand the relationship, of course the character expression More direct than numerical expression ^o^, but it is better to add this field) Such a category table with infinite classification is established. Next, it is necessary to establish a database to store information. A table is most convenient for processing queries, so create a table here Store information type_message: id (int): the serial number of the message; typeid (int): the id number of the category; title (varchar): message title; message (text): message content; time: the time when the message was created; these two The data table can complete the task of unlimited classification (the auxiliary fields of the two tables are not added, readers can add them by themselves). The remaining tasks are all handled by php.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531804.htmlTechArticle2. Database planning------------------ ------------------------------------- We talked about the complexity of classification earlier, so How to plan the database becomes very important to achieve unlimited classification...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn