Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //connect to database
- include('dataBaseConnection.inc');
- include('linkcss.php');
- include('Product.php');
- session_start();
- $product = array();
- $product = unserialize($_SESSION['product']);
- var_dump($product);
- foreach($product as $key => $value){
- $id = $value->getId();
- $name = $value->getName();
- $color = $value->getColor();
- $size = $value->getSize();
- $qty = $value->getQuantity();
- $inventory_res = "SELECT * FROM inventory WHERE item_id='".$id."'";
- $inventory_sql = $conn -> query($inventory_res) or die($conn->error);
- if($inventory_sql->num_rows >= 1){
- while($inventory_check = $inventory_sql->fetch_array()) {
- $inv_item = $inventory_check['item_id'];
- $inv_color = $inventory_check['item_color'];
- $inv_size = $inventory_check['item_size'];
- $inv_qty = $inventory_check['inventory'];
- $newqty = $inv_qty - $qty;
- $resStatement = "UPDATE inventory SET inventory ='".$newqty."' WHERE item_id ='".$id."' AND item_color ='".$color."' AND item_size ='".$size."' ";
- $sqlStatement = $conn->query($resStatement) or die("Can't update record");
- }
- $inventory_sql->free();
- }
- else
- echo "<h1>PROBELM</h1>";
- }
- $conn->close();
- ?>
- <html class="p-3 mb-2 bg-info text-white">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Show Cart</title>
- <link rel = "icon" type = "img/png" href = "XYZlogo.png">
- </head>
- <body class="p-3 mb-2 bg-info text-white">
- <div id="body">
- <header class="row">
- <img src="XYZlogo.png" alt="XYZ logo Shopping Cart" width="10%" height="17%" >
- <h1><b>XYZ Store Website</b></h1>
- </header>
- <div class="row">
- <nav class="col-lg-2" class="col-sm-12">
- <ul><a href="index.html"><li>Home</li></a>
- <a href="contact.html"><li>Contact Us</li></a>
- <a href="aboutUs.html"><li>About Us</li></a>
- <a href="seestore.php"><li>Store</li></a>
- </ul>
- </nav>
- <main class="col-lg-9" class="col-sm-12">
- <h2>Thank you for your purchase!</h2>
- <a href="index.html">Back to Website</a><br>
- </main>
- </div>
- <p></p>
- <footer class="col-lg-12">
- <p><i>
- XYZ Corporations©<br>
- Thomas Deschenes<br>
- thomd00@outlook.com
- </i></p>
- </footer>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement