$value ) { $requestStr.=$key . " : " . $value . "\n"; error_log ( $key . " : " . $value . "
\r\n" ); } error_log ( "End Printing Request Attributes" ); save_log($requestStr,'Dispensary Stock','SAVE','stock_update.php'); $itemId = $_POST['stock_item_id']; echo $itemId; $stock_qty = $_POST['stock_qty']; $check_item="select item_id from item_stock_dispensary where item_id='".$itemId."' and ohc_location_id='".$_SESSION['current_ohcttype']."' "; $check_items=mysqli_query($conn,$check_item); $row_check =@mysqli_num_rows ( $check_items ); $query=""; if($row_check>0) { $query = "update item_stock_dispensary set stock_qty = '$stock_qty' where item_id='".$itemId."' and ohc_location_id='".$_SESSION['current_ohcttype']."'"; } else{ $query = "insert into item_stock_dispensary set item_id = '$itemId',stock_qty = '$stock_qty' , ohc_location_id='".$_SESSION['current_ohcttype']."'"; } if (!$result = @mysqli_query($conn,$query)) { error_log("Error saving Item stock".mysqli_error($conn).". Error Query:".$query); exit(mysqli_error($conn)); } ?>