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
Here is the PHP code
Copy the Code code as follows:
$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 "
";
$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 "
". $category."";
}
}
}
?>
http://www.bkjia.com/PHPjc/825289.html www.bkjia.com true http://www.bkjia.com/PHPjc/825289.html techarticle 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 ...