Php returns the code for the list of infinitely classified data with arrays. Copy the code as follows: * ---------------- *-obtain the list data of an infinite category *------------------
The code is as follows:
/*------------------*/
//-Obtain the list data of an unlimited category
/*------------------*/
Function get_sort ($ parent_id = 0, $ n =-1)
{
Global $ db;
Static $ sort_list = array ();
$ SQL = "SELECT * FROM". $ db-> table ('article _ sort '). "WHERE 'parent _ id' =' {$ parent_id }'";
$ Res = $ db-> query ($ SQL );
If ($ res)
{
$ N ++;
While ($ row = $ db-> fetch_assoc ($ res ))
{
$ SQL = "SELECT * FROM ". $ db-> table ('article _ sort '). "WHERE 'parent _ id' = '{$ row ['sort _ id']}'";
$ Children = $ db-> num_rows ($ SQL );
$ Row ['sort _ name'] = str_repeat ('', $ n * 4). $ row ['sort _ name'];
$ Row ['Children '] = $ children;
$ Sort_list [] = $ row;
Get_sort ($ row ['sort _ id'], $ n );
}
}
Return $ sort_list;
}
The http://www.bkjia.com/PHPjc/322311.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322311.htmlTechArticle code is as follows:/* ---------------- * //-get the list data of infinite classification /*------------------...