apl-mhd

Tree

Dec 24th, 2018
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function tree($parent){
  2.     global $con;
  3.     $sql = "select * from category where parentid =$parent";  
  4.     $result =  $con->query($sql);
  5.  
  6.     while ($row = $result->fetch_assoc()) {
  7.             echo $row['childid']." ".$row['childname']."<br>";
  8.             tree($row['childid']);
  9.    
  10.     }
  11. }
  12.  
  13. $tree(select all id where parentid is null)
RAW Paste Data