i'm trying to update quantities left in stock on all items in the order, when the order is completed in a point of sale system
my code so far is
$order=$_GET["order"];
include('php/config.php');
$invoice=$order;
$voucher=$_GET['voucher'];
$card=$_GET['card'];
$cash=$_GET["cash"];
$date = date('Y-m-d');
$sql="SELECT * FROM `orders` WHERE `invoice` = '".$invoice."'";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$parts[] = array(
"part" => $row['part'],
"qty" => $row['qty'],
);
$sqlstock = "UPDATE `stock` SET available='available - $parts[qty]' WHERE
part = '".$parts['part']."'";
}