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


$sql = "SELECT id, product_id,unit_price, (select product_name from products where id=temp.product_id)as product_name, quantity FROM temp 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['unit_price'];
    }

} else {
    echo "0 results";
}

mysqli_close($conn);
?>