0
点赞
收藏
分享

微信扫一扫

php 无限递归查询子id 子类 根据父分类 父ID 查询所有子分类 子ID

覃榜言 2022-09-06 阅读 26

function posterity($fid)
{
global $connection;
//static $children=array();
global $children;
$sql = "SELECT DEPT_ID FROM department WHERE DEPT_PARENT= $fid";
$cursor = exequery( $connection, $sql);
while ($row = mysql_fetch_array($cursor)) {




$children[]=$row[DEPT_ID];
$pid = $row[DEPT_ID];

posterity($pid);


}return $children;
}

举报

相关推荐

0 条评论