<?php
include'config.php'; 
$querry3="Select * from tbl_features where parent ='".$id."'group by fnid order by id";
$result3 =  mysqli_query($con, $querry3);
while($row3 = mysqli_fetch_array($result3)) 
{
	$querry2="Select * from tbl_permission where user='".$user1."' and desi='".$desi."' ";
	$result2 =  mysqli_query($con, $querry2);
	while($row2= mysqli_fetch_array($result2)) 
	{
		$version= substr($row2[$row3['fnid']], 0,1);
		$fnid=$row3['fnid'];
		$fetch[] = array("id"=>$row3['id'],"version"=>$version,"file_name"=>$row3['file_name'],"fname"=>$row3['fname']);
		$categories=$fetch;
	}
}
$i=0;
foreach($categories as $p_cat){
	$categories[$i]['sub'] = get_Parent2($p_cat['id'],$p_cat['version']);
	$i++;
}
return $categories;  
?>