Copy the Code code as follows:
/*—————————————————— */
– Get list data for an unlimited assortment
/*—————————————————— */
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). $row [' Sort_name '];
$row [' children '] = $children;
$sort _list[] = $row;
Get_sort ($row [' sort_id '], $n);
}
}
return $sort _list;
}
The above describes the return base PHP with an array to return the list of infinite categories of data, including the return to the base of the content, I hope to be interested in PHP tutorial friends helpful.