The following is an example of using Php to classify and read unlimited columns. I hope this article will help you.
The following is an example of using Php to classify and read unlimited columns. I hope this article will help you.
How to Implement the infinitus topic classification idea: Get the auto-increment ID (that is, the parent ID) and then obtain the sub-ID (that is, the 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 ."";
}
}
}
?>
,