recursive function to get all the child categories

后端 未结 7 833
时光取名叫无心
时光取名叫无心 2020-12-03 03:54

Here is what I\'m trying to do: - i need a function that when passed as an argument an ID (for a category of things) will provide all the subcategories and the sub-sub categ

7条回答
  •  爱一瞬间的悲伤
    2020-12-03 04:37

    ";  
      categoryChild($childId);    
       }   
    
      function categoryChild($childId) {   
    
        $s = "select user_id from ajent_joining where sponser_id='".$childId."'";
        $r = mysql_query($s);
        if(mysql_num_rows($r) > 0) {
    
           while($row = mysql_fetch_array($r)) {
    
              echo $childId=$row["user_id"];
              echo "
    "; categoryChild($childId); } } } ?>

提交回复
热议问题