<?php
	$member=$_GET['member'];
	$ISBN=$_GET['ISBN'];
	$oQuantity = $_GET['originalQuantity'];
	
	include("connect.php");
	$result4 = mysql_query("SELECT * FROM item WHERE ISBN = '$ISBN'");
	$row = mysql_fetch_array($result4);
	$oldQuantity = $row[itemQuantity];
	$oldSales = $row[itemSales];
	
	$newQuantity = $oldQuantity + $oQuantity;
	$newSales = $oldSales - $oQuantity;
	$result2 = mysql_query("UPDATE item SET itemQuantity = '$newQuantity', itemSales = '$newSales' WHERE ISBN = '$ISBN'");
	
	$query=mysql_query("delete from temcart where temID='$member'&&temItem='$ISBN'");
	echo "<script>alert('Item remove from cart.')</script>";
	echo "<script language='javascript'>window.location='subtemcart.php'</script>"; 
?>