CasperSecurity
<?php
session_start();
include '../../../../web/connection/connection.php';
// add fee structure variables
$fee_structure_id = $_REQUEST['fee_structure_id'];
$academic_session = $_REQUEST['academic_session'];
$class_id = $_REQUEST['class_id'];
$branch_id = $_REQUEST['branch_id'];
$approve_status = $_REQUEST['approve_status'];
$student_type = $_REQUEST['student_type'];
$created_on = date('Y-m-d');
$created_by = $_SESSION['USER_ID'];
$is_active = 'yes';
// add fee structure item variables
$fee_structure_item_id = $_REQUEST['fee_structure_item_id'];
$fee_structure_id = $_REQUEST['fee_structure_id'];
$fee_item_id = $_REQUEST['fee_item_id'];
$academic_year = $_REQUEST['academic_year'];
$fee_amount = $_REQUEST['fee_amount'];
// inserting data into fee structure table
$db_handle = new DBController();
$newInsert = $db_handle->tableinsert("INSERT INTO fee_structure(fee_structure_id,academic_session,class_id,branch_id,approve_status,student_type,created_on,created_by,is_active)
VALUES('$fee_structure_id','$academic_session','$class_id','$branch_id','$approve_status','$student_type','$created_on','$created_by','$is_active')");
if($newInsert == TRUE){
echo 'Data Inserted Successfully in table 1';
}else{
echo 'Not Inserted in 1' ;
}
//if insertion is successful in fee structure table then fetch a particular primary key needed
$db_handle = new DBController();
$select = $db_handle->runQuery("SELECT fee_structure_id FROM fee_structure WHERE class_id = '$class_id' ");
foreach ($select as $v){
$fee_structure_id = $v['fee_structure_id']; // unique primary key needed as a data for the nested table
}
// inserting data into fee structure item table
$db_handle = new DBController();
$newInsert2 = $db_handle->tableinsert("INSERT INTO fee_structure_item(fee_structure_item_id,fee_structure_id,fee_item_id,academic_year,fee_amount)
VALUES('$fee_structure_item_id','$fee_structure_id','$fee_item_id','$academic_year','$fee_amount')");
if($newInsert2 == TRUE){
echo 'Data Inserted Successfully in table 2';
}else{
echo 'Not Inserted in 2' ;
}
?>