<?php

$sql1="select SUM(quantity) from bar_inventory where item_id='$data'";
$result1 = mysqli_query($conn,$sql1)or die( mysqli_error($conn));
$row1=mysqli_fetch_array($result1);
$qty=$row1['SUM(quantity)'];

$sql10="select  SUM(quantity) from orders where status='0' and item_id='$data' ";
$result10 = mysqli_query($conn,$sql10)or die( mysqli_error($conn));
$row10=mysqli_fetch_array($result10);
$rqty=$row10['SUM(quantity)'] ;

$total_remaining_item= $qty - $rqty;

if ($total_remaining_item <=0) {
    $text='Out of stock';
    $read='btn-warning';



  }
  else {
    $text='Instock';
    $read='btn-success';
   
  }
?>