<?php
include 'db_connection.php';

$reply_id = isset($_POST['reply_id']) ? intval($_POST['reply_id']) : 0;

if ($reply_id > 0) {
    $sql = "DELETE FROM message_replies WHERE reply_id = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("i", $reply_id);
    if ($stmt->execute()) {
        echo json_encode(['status' => 'success']);
    } else {
        echo json_encode(['status' => 'error', 'message' => 'Failed to delete reply']);
    }
    $stmt->close();
} else {
    echo json_encode(['status' => 'error', 'message' => 'Invalid input']);
}

$conn->close();
?>
