When browsing the binary tree I want to return an array of recursive functions. In particular when an element in binary tree reaching conditions (if statement) is inserted into the array. After all, the element returns an array of all. My code not work !??
function tree_view($clear_static = false,$conn,$index)
{
static $count = 0;
if ($clear_static) {
$count = 0;
}
$q=mysql_query("SELECT user_id FROM thanhvien WHERE gioithieu='".$index."'",$conn);
while($arr=mysql_fetch_assoc($q))
{
if (truongban($conn,$arr["user_id"],1)==true){
$mang[$count]=$arr["user_id"];
$count++;
}
tree_view(false,$conn,$arr["user_id"]);
}
return $mang;
}
$mang1=tree_view (true,$conn,anloc);
print_r($mang1);