<?php
include '../db.php'; // Replace with your actual connection file

// Get the raw POST data
$data = json_decode(file_get_contents('php://input'), true);

// Check if required data is provided
if (isset($data['q_id']) && isset($data['q_status'])) {
    $q_id = mysqli_real_escape_string($con, $data['q_id']);
    $q_status = mysqli_real_escape_string($con, $data['q_status']);

    // Update the query status in the database
    $update_query = "UPDATE query_table SET q_status = '$q_status' WHERE q_id = '$q_id'";
    if (mysqli_query($con, $update_query)) {
        echo "Status updated successfully.";
    } else {
        echo "Failed to update status: " . mysqli_error($con);
    }
} else {
    echo "Invalid input.";
}

// Close the database connection
mysqli_close($con);
?>