<?php
// view_mrp.php

// Include your database connection or any necessary files here
require_once('includes/load.php');

// Check if no_order parameter is set
if (isset($_POST['no_order'])) {
    $noOrder = $_POST['no_order'];

    // Fetch MRP data from mrp_baru table based on no_order
    $query = "SELECT * FROM mrp_baru WHERE no_order = '$noOrder'";
    $result = $db->query($query);

    if ($result->num_rows > 0) {
        $mrpDataArray = array(); // Initialize an array to store multiple rows

        while ($row = $result->fetch_assoc()) {
            $mrpDataArray[] = $row; // Add each row to the array
        }

        // Return MRP data as JSON or any desired format
        echo json_encode($mrpDataArray);
    } else {
        echo "No MRP data found for No Order: $noOrder";
    }
} else {
    echo "No Order parameter not set.";
}
?>
