"Unauthorized")); exit(); } $database = new Database(); $db = $database->getConnection(); $data = json_decode(file_get_contents("php://input")); if (!empty($data->id)) { try { $query = "DELETE FROM spbu WHERE id = :id"; $stmt = $db->prepare($query); $stmt->bindParam(":id", $data->id); if ($stmt->execute()) { http_response_code(200); echo json_encode(array("message" => "SPBU berhasil dihapus")); } else { http_response_code(503); echo json_encode(array("message" => "Gagal menghapus SPBU")); } } catch(PDOException $e) { http_response_code(500); echo json_encode(array("message" => "Error: " . $e->getMessage())); } } else { http_response_code(400); echo json_encode(array("message" => "ID tidak ditemukan")); } ?> "Unauthorized")); exit(); } $database = new Database(); $db = $database->getConnection(); $data = json_decode(file_get_contents("php://input")); if (!empty($data->id)) { try { $query = "DELETE FROM spbu WHERE id = :id"; $stmt = $db->prepare($query); $stmt->bindParam(":id", $data->id); if ($stmt->execute()) { http_response_code(200); echo json_encode(array("message" => "SPBU berhasil dihapus")); } else { http_response_code(503); echo json_encode(array("message" => "Gagal menghapus SPBU")); } } catch(PDOException $e) { http_response_code(500); echo json_encode(array("message" => "Error: " . $e->getMessage())); } } else { http_response_code(400); echo json_encode(array("message" => "ID tidak ditemukan")); } ?>