<?php
// =====================================================
// POST /update_issues.php
// Params: id, title
// Response: { status }
// =====================================================
require_once 'config.php';

$conn = getConnection();

$id    = $_POST['id']    ?? '';
$title = $_POST['title'] ?? '';

if (empty($id) || empty($title)) {
    echo json_encode(["status" => "error"]);
    exit;
}

$stmt = $conn->prepare("UPDATE issue SET title = ? WHERE id = ?");
$stmt->bind_param("si", $title, $id);

if ($stmt->execute()) {
    echo json_encode(["status" => "success"]);
} else {
    echo json_encode(["status" => "error"]);
}

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