CasperSecurity
<?php
session_start();
// daily attendance variables
include '../../../../web/connection/connection.php';
$employee_id = $_REQUEST['employee_id'];
$attendance_date = $_REQUEST['attendance_date'];
$in_time = $_REQUEST['in_time'];
$out_time = $_REQUEST['out_time'];
$attendance_status = $_REQUEST['attendance_status'];
$created_on = date("Y-m-d");
$created_by = $_SESSION['USER_ID'];
$is_active = 'yes';
// daily attendance info variables
$id = $_REQUEST['id '];
$file_name = $_REQUEST['file_name'];
$file_path = $_REQUEST['file_path'];
$file_date = $_REQUEST['file_date'];
$file_purpose = $_REQUEST['file_purpose'];
// inserting data into daily attendance table
$db_handle = new DBController();
$newInsert = $db_handle->tableinsert("INSERT INTO daily_attendance (employee_id,attendance_date,in_time,out_time,
attendance_status,created_on,created_by,is_active)
VALUES('$employee_id','$attendance_date','$in_time','$out_time','$attendance_status','$created_on','$created_by','$is_active')");
if($newInsert == TRUE){
echo 'Data Inserted Successfully in table 1';
//if insertion is successful in daily attendance table then fetch a particular primary key needed
$db_handle = new DBController();
$select = $db_handle->runQuery("SELECT daily_attendance_id FROM branchs WHERE employee_id = '$employee_id' ");
foreach ($select as $v){
$daily_attendance_id = $v['daily_attendance_id']; // unique primary key needed as a data for the nested table
}
// inserting data into daily attendance info table
$db_handle = new DBController();
$newInsert2 = $db_handle->tableinsert("INSERT INTO daily_attendance_info(id,file_name,file_path,file_date,file_purpose)
VALUES('$id','$file_name','$file_path','$file_date','$file_purpose')");
if($newInsert2 == TRUE){
echo 'Data Inserted Successfully in table 2';
}else{
echo 'Not Inserted in 2' ;
}
}else{
echo 'Not Inserted in 1' ;
}
?>