<?php
include '../includes/connection.php';


$sql = "SELECT id, product_id, (select product_name from products where id=getstock.product_id)as product_name, quantity,unitprice,expiry_date,batch_no FROM getstock where id='$newid'";

$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        $prod_id=$row['product_id'];
        $prod_name=$row['product_name'];
        $qty=$row['quantity'];
        $id=$row['id'];
        $unitprice=$row['unitprice'];
        $expiry_date=$row['expiry_date'];
        $batch_no=$row['batch_no'];
    }

} else {
    echo "0 results";
}

mysqli_close($conn);
?>