Realize infinite Pole column classification idea: Get the self-increment ID (that is, the parent ID) and then get the child ID (that is, the UID sub-ID) data to the database as follows
Id:1 uid:0 I am the column 1
Id:2 uid:1 I am the column 2
Id:3 Uid:1 I'm a subclass of column 1
Show Results:
I am the column 1
I'm a subclass of column 1.
I am the column 2
<?php
$query = $this->db->query ("Select * from category");
$list = $query->result ();
foreach ($list as $v) {
if ($v->category_id = = 0) {//Get the parent column (equals 0 is the parent column)
$categoryul = anchor ("home/content/". $v->id, $v->category_name);
echo "<ul>". $categoryul. " </ul> ";
$LISTX = $this->listx->list_id ($v->id);//The specified sub-column is displayed according to the parent ID
foreach ($listx as $vid) {
$category = anchor ("home/content/". $vid->id, $vid->category_name);
echo "<li>". $category. " </li> ";
}
}
}
?>
PHP Infinite Column Classification read the implementation code