php finds out according to the parent id, PHP infinite classification finds the parent function_weixin_39653442’s blog
PHP unlimited classification to find the parent layer function classID classFID className classCount 1 0 0 0 2 1 1 Zhejiang 0 3 1 1 Jiangsu 0 4 2 2 Hangzhou 0 5 4 4 West Lake District 0 If findFather(4,0) shows => Hangzhou findFather(4,1) shows => Zhejiang findFather(4,2) shows => China findFather(4,3) shows => China -> Zhejiang -> Hangzhou The code is as follows: //========= = findFather function START =========== // Function: Finding the father of unlimited classification Layer related data // Parameters: $classID, current class layers number // $type, 0 looking for self 1 looking for father 2 Find ancestors 3 Find genealogy // Field: classID primary key, since generate classFID parent number // className category name classCount category statistics functionfindFather($classID,$type) { global$db,$flist,$forefa ther; define(“_STR_CUT”, ” ->”) ; $db->query(“set names ut f8” ); $sql=select * from tbl_name where classID = “.$classID.”; $result=$db->query($sql ); $recordCount=$result->num _rows; /phprm/27846.htmlwww.phpzy.comtrue/phprm/27846.htmlTechArticlePHP Unlimited classification search parent function classID classFID className classCount 1 0 China 0 2 1 Zhejiang 0 3 1 Jiangsu 0 4 2 Hangzhou 0 5 4 West Lake District 0 If findFather(4,0) display = Hangzhou findFather(4,1) display = Zhejiang findFather(4,2) display = China… Related articles No related articles Friends of PHP…