<?php
// Database connection
include("includes/db.php");

if (isset($_GET['id'])) {
    $id = (int) $_GET['id'];
    
    // Update the status of the message to 'resolved'
    $sql = "UPDATE support_messages SET status = 'resolved' WHERE id = $id";
    
    if ($conn->query($sql) === TRUE) {
        echo "Message marked as resolved.";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
}

$conn->close();

// Redirect back to the admin page
header('Location: admin_view_messages.php');
?>
