ohctech_p8/select_item_stock.php
2024-10-16 19:18:52 +05:30

21 lines
646 B
PHP

<?php
include('includes/config/config.php');
$itemId = $_REQUEST['item_id'];
$batch = $_REQUEST['item_batch_no'];
error_log("item_id".$item_id." ".$batch);
$query = "select sum(stock_qty) as stock_qty from item_stock where item_id = '" . $item_id . "' ";
error_log("fetching stock:" . $query);
if (!$result = @mysqli_query($conn,$query)) {
error_log("error in fetching stock:" . $query);
}
$data = array();
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$data = $row['stock_qty'];
}
} else {
$data['status'] = 200;
$data['message'] = "Data not found!";
}
echo json_encode($data);
?>