1
$prodqty = mysql_query("SELECT quan FROM pro_list WHERE auto_id = $pid"); //get the current product quantity
if (mysql_num_rows($prodqty) != 0)
{
$row = mysql_fetch_array($prodqty);
$productqty = $row['quan'];
}
$nqty = $productqty-$q; //current product quantity minus order quantity to get new product quantity
if ($nqty >= 0)
{
$query2="UPDATE pro_list SET quan = $nqty WHERE auto_id = $pid"; //update the quantity in the product table
$result = mysql_query($query2);
if ($result)
echo "Successfully ";
else
echo "Unsuccesfully";
}
else
echo "Limit of quantity! .";
}
die('Thank You For Shopping With i-Supply System! your order has been sent to Admin.!');
}
재고가 한계를 초과했지만 주문이 여전히 데이터베이스에 삽입됩니다. 주문량이 이미 제품 수량을 초과하여 주문서에 삽입해서는 안됩니다. 고객은 다시 주문해야합니다. 왜 이런 일이 일어날까요?재고가 여전히 제한되어 있고 주문 표에 여전히 삽입되어 있습니다.
'$ q'를 보여주십시오. 실제로'$ nqty = $ productqty- $ q'는 보지 못합니다. – Imran
$ nqty는 주문 후 제품 잔액이며 $ productqty는 주식의 실제 수량이며 $ q는 고객이 주문하는 동안의 수량입니다. @imran – ayeen