<?php
include 'connect.php';
if (isset($_POST['show_status'])) {
    // Fetch items based on show_status
    $show_status = $_POST['show_status'];
    $query = "SELECT * FROM a_items WHERE ItemShow_status = $show_status";
    
} elseif (isset($_POST['outofstock_status'])) {
    $outofstock_status = $_POST['outofstock_status'];
    $query = "SELECT * FROM a_items WHERE ItemOutOfStock_status = $outofstock_status";
} 
$result_set = mysqli_query($con,$query);

if ($result_set) {
    $items = array(); // Initialize an array to store the items

    while ($row = mysqli_fetch_assoc($result_set)) {
        $items[] = $row;
    }
}

echo json_encode($items);
?>