<?php
header('content-type:application/json');
include($_SERVER['DOCUMENT_ROOT'] . "/API-Others/connection/conn.php");
$invoiceNo = $_GET["invoiceNo"];
$query = mysqli_query($conn, "SELECT * FROM stocklist WHERE invoice_no = '$invoiceNo' ORDER BY invoice_no, category");
$stock_list = array();
while ($spec = mysqli_fetch_assoc($query)) {
    $stock_list[] =  $spec;
}

$resultData = array('code' => $statusCode, 'message' => $statusMessage, 'stock_list' => $stock_list);
echo json_encode($resultData);