62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
|
|
<?php
|
|
include('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
include ('log_entry.php');
|
|
error_log ( "Start Printing Request Attributes" );
|
|
$requestStr="";
|
|
foreach ( $_REQUEST as $key => $value ) {
|
|
$requestStr.=$key . " : " . $value . "\n";
|
|
error_log ( $key . " : " . $value . "<br />\r\n" );
|
|
}
|
|
error_log ( "End Printing Request Attributes" );
|
|
save_log($requestStr,'delete Attendence','DELETE','attendence_delete.php');
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
|
|
if (isset($_REQUEST['ba_id'])) {
|
|
$id = $_REQUEST['ba_id'];
|
|
|
|
$query = "DELETE FROM attendance_batch WHERE id = ?";
|
|
error_log("Delete query: " . $query);
|
|
|
|
if ($stmt = mysqli_prepare($conn, $query)) {
|
|
mysqli_stmt_bind_param($stmt, 'i', $id);
|
|
|
|
if (mysqli_stmt_execute($stmt)) {
|
|
|
|
$query = "DELETE FROM beneficiary_attendence WHERE pti_id = ?";
|
|
error_log("Delete query: " . $query);
|
|
|
|
if ($stmt = mysqli_prepare($conn, $query)) {
|
|
mysqli_stmt_bind_param($stmt, 'i', $id);
|
|
|
|
if (mysqli_stmt_execute($stmt)) {
|
|
echo json_encode("SUCCESS");
|
|
|
|
} else {
|
|
error_log("Error executing delete query: " . mysqli_stmt_error($stmt));
|
|
echo json_encode("FAILURE");
|
|
}
|
|
}
|
|
|
|
mysqli_stmt_close($stmt);
|
|
|
|
} else {
|
|
error_log("Error preparing delete query: " . mysqli_error($conn));
|
|
echo json_encode("FAILURE");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
error_log("id is not set.");
|
|
echo json_encode("FAILURE");
|
|
}
|
|
?>
|
|
|
|
|