Commit 46c8bff2 authored by trh010's avatar trh010

edited stock shelves and refinded checkout+admin

parent 3a708ee3
File mode changed from 100644 to 100755
......@@ -18,8 +18,6 @@
if (!$result) die("Query1 failed!" . mysql_error());
$row = mysql_fetch_row($result);
$num_on_shelves = intval($row[0]);
//echo "<br>".$item . "<br>" . $quantity . "<br>" . $num_in_stock . "<br>";
// if we can update the database
if($num_in_stock > $quantity and $num_in_stock > 0){
......@@ -27,8 +25,13 @@
// update GroceryShelves
$new_onShelves_quant = $num_on_shelves + $quantity;
//echo $new_onShelves_quant . "<br>";
if($num_on_shelves == 0){
$result = mysql_query("INSERT INTO GroceryShelves (item,count)VALUES ('$item',$new_onShelves_quant);");
if (!$result) die("Query2 failed!" . mysql_error());
} else {
$result = mysql_query("UPDATE GroceryShelves SET GroceryShelves.count=($new_onShelves_quant) WHERE item='$item';");
if (!$result) die("Query2 failed!" . mysql_error());
}
// update StockShelves
$new_inStock_quant = $num_in_stock - $quantity;
......
......@@ -144,6 +144,7 @@
mysql_free_result($result);
?>
<h2>All Carts Ever</h2>
<p><b>note: </b>empty carts are not displayed here</p>
<?php
$result = mysql_query("SELECT * FROM Carts ORDER BY cartID ASC;");
if (!$result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment