<?php session_start(); if (!isset($_SESSION['contact_no'])) { header('location:homepage.php'); } require 'vendor/autoload.php'; use Parse\ParseClient; use Parse\ParseObject; use Parse\ParseQuery; try { ParseClient::initialize('ilAdpSlcSs2PYQzZtC9k549MMrEq6GWBEkgPL052', '2ptwsyysoXq6KZ055Rz6qgAVLc6kGqq4geBcYGrV', '5o87OulNuELCkqYB3cju1ETOcLllLqB5K13F12Pg'); $query = new ParseQuery("MerchantBuy"); $query->equalto('objectId', $_SESSION["id"]); $object = $query->first(); echo $object->get("Product"); $object->set("Product", $_POST['product']); $object->set("cost", (int) $_POST['cost']); $object->set("max_amount", (int) $_POST['amount']); $object->set("Location", $_POST['location']); $object->save(); //echo "1"; header('location:merchantproductdata.php'); } catch (Exception $e) { header('location:merchantproductdata.php'); }
</div> </div><br><br><br> <center><h3>Update Product</h3></center> <br><br><br><?php session_start(); if (!isset($_SESSION['contact_no'])) { header('location:homepage.php'); } require 'vendor/autoload.php'; use Parse\ParseClient; use Parse\ParseObject; use Parse\ParseQuery; try { ParseClient::initialize('ilAdpSlcSs2PYQzZtC9k549MMrEq6GWBEkgPL052', '2ptwsyysoXq6KZ055Rz6qgAVLc6kGqq4geBcYGrV', '5o87OulNuELCkqYB3cju1ETOcLllLqB5K13F12Pg'); $query = new ParseQuery("MerchantBuy"); $query->equalto('objectId', $_GET["id"]); $result = $query->first(); $_SESSION["id"] = $_GET["id"]; $product = $result->get("Product"); $cost = $result->get("cost"); $maxAmount = $result->get("max_amount"); $location = $result->get("Location"); } catch (Exception $e) { } ?> <form action="merchantupdatesingledata.php" method="post"> <div class="form-horizontal container col-sm-8 col-sm-offset-4 "> <table id="dataTable" class="col-sm-6">
</div> </div> </div> </div><br><br><br> <center><h3>Merchant Products</h3></center> <br><br><br> <?php require 'vendor/autoload.php'; use Parse\ParseClient; use Parse\ParseObject; use Parse\ParseQuery; ParseClient::initialize('ilAdpSlcSs2PYQzZtC9k549MMrEq6GWBEkgPL052', '2ptwsyysoXq6KZ055Rz6qgAVLc6kGqq4geBcYGrV', '5o87OulNuELCkqYB3cju1ETOcLllLqB5K13F12Pg'); ?> <table class="table"> <?php $query = new ParseQuery("MerchantBuy"); $query->equalto("Merchant_Id", $_SESSION["contact_no"]); $result = $query->find(); echo "<tr>\n <td>\n<b> S.No</b>\n </td>\n <td>\n<b> Product</b>\n </td>\n <td>\n<b> Cost(Per Kg)</b>\n </td>\n <td>\n<b> Maximum Amount(Kg)</b>\n </td>\n <td>\n<b> Location</b>\n </td>\n <td><b>Delete\n </b></td>\n </tr>"; for ($i = 0; $i < count($result); ++$i) { echo "<tr><td>" . ($i + 1) . "</td><td>" . $result[$i]->get("Product") . "</td><td>" . $result[$i]->get("cost") . "</td><td>" . $result[$i]->get("max_amount") . "</td><td>" . $result[$i]->get("Location") . "</td><td>" . "<a href='http://localhost/Pragyan_Hack/merchantdeletedata.php?id=" . $result[$i]->getObjectId() . "'>Delete</a></td></tr>"; } ?> </table> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> </body> </html>