SoFunction
Updated on 2025-04-12

php Advanced: Implementing Unlimited Classification Page 2/4


2. Database planning
------------------------------------------------------------ 
As mentioned earlier, how to plan a database has become a very important step in realizing infinite classification.

I have introduced the database planning of the forum. Good forums can achieve infinite follow-up. Infinite classification is this form of expansion. Classification is also the relationship between child and parent, so the classification database is how to establish and clarify this child and parent relationship. There are several difficulties here.

1) How to deal with information storage of various categories;
2) How to deal with classified kinship;
3) How to deal with information query;

The database processing of affinity is similar to that of a forum. Here is a database of type that is used to process classification:

Create field:
id(int): used to record the natural serial number of each category.
uid(int): The id number of the parent class used to record the classification
type(char): name of the category
roue_id(varchar): kinship tree, indicating the kinship relationship with id connection of 0:2:10:20:
roue_char(varchar): kinship tree, similar: system: linux: development tool: gcc: (It doesn’t matter whether this field has or not. In order to more conveniently understand the relationships, of course, character expressions are more direct than numerical expressions^o^, but it is best to add this field)

In this way, an infinitely classified category table is established. Next, it is necessary to establish a database of stored information. It is most convenient to process and query a table. So here is to create a table to store information. type_message:

id(int): the serial number of the information;
typeid(int): the id number of the category;
title(varchar):Information title;
message(text): information content;
time: the time when the information is established;

These two data tables can complete the task of infinite classification (the auxiliary fields of the two tables are not added, readers can add them by themselves).

All the remaining tasks will be handed over to php to complete.
Previous page1234Next pageRead the full text