View file File name : maincategory-del.php Content :<?php session_start(); include("../include/config.php"); include("../include/functions.php"); validate_admin(); $arr =$_POST['ids']; //print_r($_REQUEST); $Submit =$_POST['what']; if(count($arr)>0){ $str_rest_refs=implode(",",$arr); if($Submit=='Delete') { $check=mysqli_query($GLOBALS['conn'],"select id,section_id,parent_id from $tbl_maincategory where id in ($str_rest_refs)"); while($result=mysqli_fetch_assoc($check)) { if($result['parent_id']==0 AND $result['section_id']==1) { $section='grocery'; $parameter='grocery-category'; clearlaravelcache($section,$parameter); } else { $section=getSection($result['parent_id']); if($section==1) { $section='grocery'; $parameter='grocery-category'; clearlaravelcache($section,$parameter); } } } $sql="delete from $tbl_maincategory where parent_id in ($str_rest_refs)"; $obj->query($sql); $sql="delete from $tbl_maincategory where id in ($str_rest_refs)"; $obj->query($sql); $sess_msg='Selected record(s) deleted successfully'; $_SESSION['sess_msg']=$sess_msg; } elseif($Submit=='Activate') { $check=mysqli_query($GLOBALS['conn'],"select id,section_id,parent_id from $tbl_maincategory where id in ($str_rest_refs)"); while($result=mysqli_fetch_assoc($check)) { if($result['parent_id']==0 AND $result['section_id']==1) { $section='grocery'; $parameter='grocery-category'; clearlaravelcache($section,$parameter); } else { $section=getSection($result['parent_id']); if($section==1) { $section='grocery'; $parameter='grocery-category'; clearlaravelcache($section,$parameter); } } } $sql="update $tbl_maincategory set status=1 where id in ($str_rest_refs)"; $obj->query($sql); $sess_msg='Selected record(s) activated successfully'; $_SESSION['sess_msg']=$sess_msg; } elseif($Submit=='Deactivate') { $check=mysqli_query($GLOBALS['conn'],"select id,section_id,parent_id from $tbl_maincategory where id in ($str_rest_refs)"); while($result=mysqli_fetch_assoc($check)) { if($result['parent_id']==0 AND $result['section_id']==1) { $section='grocery'; $parameter='grocery-category'; clearlaravelcache($section,$parameter); } else { $section=getSection($result['parent_id']); if($section==1) { $section='grocery'; $parameter='grocery-category'; clearlaravelcache($section,$parameter); } } } $sql="update $tbl_maincategory set status=0 where id in ($str_rest_refs)"; $obj->query($sql); $sess_msg='Selected record(s) deactivated successfully'; $_SESSION['sess_msg']=$sess_msg; } } else{ $sess_msg="Please select check box"; $_SESSION['sess_msg']=$sess_msg; header("location: ".$_SERVER['HTTP_REFERER']); exit(); } header("location: maincategory-list.php"); exit(); ?>