Mini Shell
<?php
include("../config.php");
$conn = dbconnect();
date_default_timezone_set('Asia/Kolkata');
header('Content-Type: application/json');
$id = isset($_POST['id']) ? $_POST['id'] : '';
if ($id) {
$sql = "DELETE FROM tb1_alumini WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $id);
if ($stmt->execute()) {
if ($stmt->affected_rows > 0) {
$response = [
'message' => 'Record deleted successfully',
'status' => '200',
];
} else {
$response = [
'status' => '500',
'message' => 'Record not found',
];
}
} else {
$response = [
'status' => '500',
'message' => 'Error executing query',
];
}
$stmt->close();
} else {
$response = [
'status' => '400',
'message' => 'Invalid request, id is missing',
];
}
$conn->close();
echo json_encode($response);
Zerion Mini Shell 1.0