我希望逐级显示二叉树...但我无法显示
<?php
if($_GET)
{
$name = $_GET['sname'];
function showdownline($sname)
{
$con = $_SESSION['con'];
$query = "SELECT * FROM clients WHERE name = '$sname'";
$result = mysqli_query($con,$query);
if(mysqli_num_rows($result)==0)
return(0);
else{
while($row = mysqli_fetch_array($result))
{
echo $left = $row['left_client']." ";
echo $right = $row['right_client']." ";
}
showdownline($left);
showdownline($right);
}
}
showdownline($name);
}
&GT;
它向我展示了整条左腿然后向右......帮助我 我认为它首先被称为广度 预期产出 例如,如果表中的数据是ID | name | left_client | right_client|
1 | a | b | c |
2 | b | d | e |
3 | c | f | g |
4 | f | h | i |
5 | g | j | k |
如果我们想获得成员a的树然后输出那么输出应该是
a , b , c , d, e ,f ,g, h, i, j, k