$conn = mysqli_connect("localhost", "mytutorial", "funtoofun", "tutorialdb");
$sqlquery = "select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id NOT IN (select fki_id from menupermissions where fki_role !='".$role."')";
if($EmpNumber !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_emp_number ='231')";
}
if($EmpDesig !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_desig_id ='developer')";
}
if($EmpDepID !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_dep_id ='IT02')";
}
if($DepType !=''){
$sqlquery .= "Union select * from menu where pid = '".$parent_id."' and fki_status = '1' and pki_id IN (select fki_id from menupermissions where fki_dep_type ='ittutorial')";
}
if($parent_id==0){
$sqlquery .= " order by sequence";
}