<?php
include "../db.php";

if (isset($_POST['product_id']) && isset($_POST['status'])) {
    $pid = mysqli_real_escape_string($con, $_POST['product_id']);
    $status = mysqli_real_escape_string($con, $_POST['status']);

    $query = "UPDATE product SET pStatus = '$status' WHERE pid = '$pid'";
    if (mysqli_query($con, $query)) {
        echo "Status updated successfully";
    } else {
        echo "Error updating status: " . mysqli_error($con);
    }
} else {
    echo "Invalid data";
}
?>