CasperSecurity
<?php
session_start();
include '../../../../web/connection/connectionv2.php';
include '../../../../web/connection/con.php';
include '../../../../web/connection/encryption.php';
$sgroup_id = $_REQUEST['isgrpid'];
$grp_id = $_REQUEST['grp_name'];
$subgrp_name = $_REQUEST['subgrp_name'];
date_default_timezone_set("Asia/Kolkata");
$date = date("Y-m-d H:i:s");
$active = 'yes';
$userId = $_SESSION['USER_ID'];
$db_handle = new DBController();
$subgroups = $db_handle->runQuery("SELECT * FROM canteen_item_subgroup WHERE item_subgroup_id='$sgroup_id'");
foreach($subgroups as $subgroup){
$item_group_id = $subgroup['item_group_id'];
}
if(!empty($grp_id)){
$db_handle = new DBController();
$newUpdate = $db_handle->runMyUpdate("UPDATE canteen_item_subgroup
SET item_group_id='$grp_id',item_subgroup_name ='$subgrp_name',modified_on ='$date',modified_by = '$userId' WHERE item_subgroup_id = '$sgroup_id'");
}else{
$db_handle = new DBController();
$newUpdate = $db_handle->runMyUpdate("UPDATE canteen_item_subgroup
SET item_group_id='$item_group_id',item_subgroup_name ='$subgrp_name',modified_on ='$date',modified_by = '$userId' WHERE item_subgroup_id = '$sgroup_id'");
}
if($newUpdate == TRUE){
$_SESSION['ERROR_MSG'] = "Success";
$_SESSION['MSG_ALRT'] = "TRUE";
header('location:../../../../web/home/modules/university/Canteen/item_subgroup/item_subgroup.php');
}else{
$_SESSION['ERROR_MSG'] = "Unsuccess";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:../../../../web/home/modules/university/Canteen/item_subgroup/item_subgroup.php');
}