The following is an example of using Php to classify and read unlimited columns. I hope this article will help you with the idea of classifying Infinitus columns: getting auto-increment IDs (that is, parent IDs) then obtain the sub-ID (uid sub-id) data in the database as follows:
Id: 1 uid: 0 I'm column 1
Id: 2 uid: 1 I'm column 2
Id: 3 uid: 1 I'm a subclass of column 1
Display result:
I am column 1
I am a subclass of column 1.
I am column 2
Below is the Php code
The code is as follows:
$ Query = $ this-> db-> query ("SELECT * FROM category ");
$ List = $ query-> result ();
Foreach ($ list as $ v ){
If ($ v-> category_id = 0) {// Obtain the Parent column (all columns equal to 0 are parent columns)
$ Categoryul = anchor ("home/content/". $ v-> id, $ v-> category_name );
Echo"
";
$ Listx = $ this-> Listx-> list_id ($ v-> id); // display the specified sub-column based on the parent id
Foreach ($ listx as $ vid ){
$ Category = anchor ("home/content/". $ vid-> id, $ vid-> category_name );
Echo"
". $ Category ."";
}
}
}
?>