csrtechnew.ohctech.in/delete_state.php
2025-04-14 13:28:09 +05:30

34 lines
1.1 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 state','DELETE','delete_state.php');
// Check if subject_id is provided in the request
if(!empty($_REQUEST['state_id'])){
// Construct the delete query
$query = "DELETE FROM states WHERE id = '".$_REQUEST['state_id']."'";
// Log the query for debugging
error_log('state_delete: ' . $query);
// Execute the query and handle errors
if (!$result = @mysqli_query($conn, $query)) {
// If query execution fails, log the error and return FAILURE response
exit(mysqli_error($conn));
echo json_encode("FAILURE");
} else {
// If query execution succeeds, return SUCCESS response
echo json_encode("SUCCESS");
}
}
?>