Location: PHPKode > projects > Pet Grooming Management System > pet/shopItem4.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>PGMS Use Item in shop page 4</title>
<META HTTP-EQUIV="REFRESH" CONTENT=2;URL=blank.php">
</head>
<body>
<?php
$date = date('Y-m-d');
$iid = $_POST['iid'];
$qty = $_POST['qty'];
$cost = $_POST['cost'];
$shop = $_POST['shop'];
$newQty =$qty-$shop;
require ('header.inc');
require ('info.inc');
require ('invDesc.inc');
mysql_connect('localhost',$r,$p) or die("Could not connect to Host.");
mysql_select_db($d) or die("Could not select database.");
$query = "insert into sales
          (iid,price,how,date_sold)
					values ('$iid','$cost','Shop Use','$date')";
$result = mysql_query($query);
	 if (mysql_affected_rows()==1){
	     echo '<P>A item has charged to the shop. You will be a blank page in 5 seconds';
			 }else{
			 echo '<P>Something went wrong with you adding a new item.</P>';
			 } 
$query = "update items set qty = '$newQty'";
$result = mysql_query($query);
	 if (mysql_affected_rows()==1){
	     echo '<P>Inventory quantity update. You will be a blank page in 5 seconds';
			 }else{
			 echo '<P>Something went wrong with you changing inventory quantity</P>';
			 } 
require('footer.inc');
?>
</body>
</html>
Return current item: Pet Grooming Management System