Back to base: return to base php code for returning list data of infinite classification with array: Copy the code as follows: * ------------------ *-get list data of infinite classes * ------------------ * functionget_sort ($ parent_SELECT * FROM. $ db-& gt; table (arti
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 above describes the code for returning the list data of the infinite classification returned by php with an array, including the returned content of the base. if you are interested in the PHP Tutorial, please help.