if(!empty($fcat)){
foreach($fcat as $fcat_val){ // main cat
$faqs_qur=Query("select DISTINCT fq_scat_id,fscat_name,fq_cat_id from apt_faqs as FS
left join apt_faq_sub_cat as C on C.fscat_id=FS.fq_scat_id
where fq_status=1 and fq_cat_id=".$fcat_val['id']);
while($faqs_row=Fetch($faqs_qur)) {
$fcats[]=array("idd"=>$faqs_row['fq_scat_id'],"cat_names"=>$faqs_row['fscat_name'],"pcatid"=>$faqs_row['fq_cat_id']);
}
?>
foreach($fcats as $fcats_val){ // sub cat
if($fcat_val['id']==$fcats_val['pcatid']){
if(!empty($fcats_val['cat_names'])){ // sub cat check
?>
} ?>
$k=0;
$qur="select * from apt_faqs as FS
left join apt_faq_cat as PC on PC.fcat_id=FS.fq_cat_id
left join apt_faq_sub_cat as PSC on PSC.fscat_id=FS.fq_scat_id
where ".$sub_qur." and FS.fq_cat_id=".$fcat_val['id']." and FS.fq_scat_id=".$fcats_val['idd']." and FS.fq_status=1 order by FS.fq_order_by DESC";
$qur_cnt=Query($qur);
$cnt=NumRows($qur_cnt);
$qns_qur=Query($qur." limit $start,$len");
//if($cnt>0){
while($row=Fetch($qns_qur)){ $k++; $l++;
?>
} } } } }else{ ?>
} ?>