function ListChildTree($SearchPattern,$BaseNum){ global $Tree;//声明连接数据库的句柄为全局 $Sql="select DepartmentId,DepartmentName from test where DepartmentId like '$SearchPattern'"; //查找孩子节点 $QueryChild=$Tree->query($Sql); while($Result=$Tree->fetch_array($QueryChild)) { //取出孩子节点 $Space=""; for($j=0;$j<((strlen($SearchPattern)/3)-$BaseNum);$j++) $Space.=" "; //设置显示节点前面的距离,这里的空格的html被这里自动替换成" "了 $ChildDepartment=trim($Result[0])."___"; $ChildSql="select count(*) from test where DepartmentId like '$ChildDepartment'";//查找孩子节点的孩子节点 $ChildResult=$Tree->query_first($ChildSql); $TableId="ta".trim($Result[0]); //设置表格Id $TablePic="ta".trim($Result[0])."pic"; //设置图片Id if($ChildResult[0]<1){//如果没有找到孩子节点的节点,则显示"-"图片 ?> <tr><td><?=$Space?><span align="absmiddle"><img src="http://edu.cnzz.cn/NewsInfo/leaf.gif" border="0" align="absmiddle" width="35" height="17"></span><font size="2"><A href="process.php?SearchPattern=<?=trim($Result[0])?>" class="F1"><?=$Result[1]?></a></font> &