File "delete.php"
Full path: /home2/santhos2/public_html/bharath-coe.firstmatrix.in.net/api/delete.php
File size: 966 B
MIME-type: text/x-php
Charset: utf-8
<?php
require_once '../../config/config.php';
require_once '../helper/audit_log.php';
header('Content-Type: application/json');
try {
$id = (int)($_POST['id'] ?? 0);
if ($id <= 0) { echo json_encode(['status'=>'error','message'=>'id required']); exit; }
$stmtB = $pdo->prepare('SELECT * FROM hall_settings WHERE hall_setting_id=?');
$stmtB->execute([$id]);
$before = $stmtB->fetch(PDO::FETCH_ASSOC);
if (!$before) { echo json_encode(['status'=>'error','message'=>'Not found']); exit; }
$pdo->prepare('DELETE FROM hall_settings WHERE hall_setting_id=?')->execute([$id]);
write_audit_log($pdo, ['module'=>'Hall Settings','action'=>'delete','entity_table'=>'hall_settings','entity_id'=>$id,'before_data'=>$before]);
echo json_encode(['status'=>'success','message'=>'Deleted']);
} catch (Throwable $e) {
http_response_code(500);
echo json_encode(['status'=>'error','message'=>$e->getMessage()]);
}
?>