<?php
session_start();
$branch=$_SESSION['branch_id'];
include '../includes/connection.php';
$idd=$_GET['id'];
$saletype=$_GET['saletype'];


$sql = "SELECT * FROM products where id='$idd' && branch_id='$branch' && status=1";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
if (strlen($saletype)<1 || $saletype==0) {
	$quantity=$row['quantity'];
        $price=$row['price'];
        $has_stock=$row['has_stock'];
        $reserve_price=$row['reserve_price'];
}else{
	$quantity=$row['quantity'];
        $price=$row['price_whole'];
        $has_stock=$row['has_stock'];
        $reserve_price=$row['reserve_price'];


}
        
        echo $quantity."|".$price."|".$has_stock."|".$reserve_price;
       
    
} else {
    echo "0 results";
}

?>