<?php

include "../db.php";

if (!isset($_GET['id'])) {
    echo json_encode(["status" => "error", "message" => "Missing job ID"]);
    exit;
}

$id = intval($_GET['id']);

$stmt = $conn->prepare("DELETE FROM job_listing WHERE id=?");
$stmt->bind_param("i", $id);

if ($stmt->execute()) {
    echo json_encode(["status" => "success", "message" => "Job deleted successfully"]);
} else {
    echo json_encode(["status" => "error", "message" => "Failed to delete job: " . $stmt->error]);
}

$stmt->close();
$conn->close();
?>
