function multilevel_cat($parent_id){    
    $retVal = array($parent_id);
        
        $sql = "SELECT cat_id,parent_id FROM `cat` WHERE parent_id='".$parent_id."'";
        $res= mysqli_query($this->conn, $sql);
        
        while($row = mysqli_fetch_assoc($res))
        {
            $retVal = array_merge($retVal,       $this->multilevel_franchise($row['cat_id']));
        }

        return $retVal;
    }