<?php
include('session.php');

$code = $_GET['code'];

$sql = "SELECT * FROM $tblproducts WHERE ProdCode='$code'";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($result);

$data = [
    "Barcode" => $row['ProdCode'],
    "ProdName" => $row['ProdName'],
    "ProdSize" => $row['ProdSize'],
    "ProdType" => $row['ProdType'],
    "Description" => $row['ProdDesc'],
    "Location" => $row['Location'],
    "Company" => $row['Company'],
    "Stock" => $row['Stock']
];

echo json_encode($data);
?>