Пример #1
0
<html>
<body>

<p>Enter the Name:</p> <input type="text" name="Nameone" />
<p>Enter the Barcode:</p> <input type="number" name="Barcodeone" />
<p>Enter the ESRB:</p> <input type="text" name="rateone" />
<p>Enter The Number Players:</p> <input type="number" name="playersone" />
<p>Enter the Price: </p> <input type = "number" name = "priceone" />
<p></p>
<input type="submit" value="AddGames" name = "submit">

<p>Select your order: <input type="text" name="productorder"> 
<input type="submit" value="purchase" name="purchasesubmit">

</body>
</html>

<?php 
$productorder = $_POST['productorder'];
if (!($productorder == 0)) {
    $queryten = executePlainSQL("SELECT Name \t\t\t\t\t\t\t\n\t\t\t\t\t\t\tFROM ProductBarcode p\t\t\t\t\t\t\n\t\t\t\t\t\t\tWHERE rownum = {$productorder}");
    $row = OCI_Fetch_Assoc($queryten);
    echo $row['Name'];
    echo $row["Name"];
    echo "you have purchased" . $row["Name"];
}
Пример #2
0
$selectedaddress = $_POST['branchaddress'];
$productname = $_POST['productname'];
$productname = strtoupper($productname);
if ($selectedcity === "----" || $selectedaddress === "----") {
    //query for searching for product name in all stores
    $query = executePlainSQL("SELECT Name, SUM(Quantity) as Quantity, City, Address, b.BID\n                FROM Has h, ProductBarcode p, Branch b \n                WHERE  h.Barcode = p.Barcode AND \n                      h.bID = b.bID AND  \n                      upper(Name) LIKE '%{$productname}%'\n                GROUP BY b.BID, City, Address, Name");
    echo "<p> If you would like to search by location, please enter BOTH city and address. </p>";
} else {
    //query filtering branch and address
    $query = executePlainSQL("SELECT Name, SUM(Quantity) as Quantity, b.City as City, b.Address as Address, b.BID\n                FROM Has h, ProductBarcode p, Branch b\n                WHERE h.Barcode = p.Barcode AND \n                      h.bID = b.bID AND  \n                      upper(Name) LIKE '%{$productname}%' AND\n                  b.City = '{$selectedcity}' AND \n                  b.Address ='{$selectedaddress}'\n                GROUP BY b.bID, b.City, b.Address, Name");
}
echo '<p> Selected products: </p> ';
if (!($_POST['productname'] == NULL)) {
    echo "<table>";
    echo "<tr><th>Order</th><th>Product</th><th>Quantity</th><th>City</th><th>Address</th></tr>";
    while ($row = OCI_Fetch_Assoc($query)) {
        echo "</tr><td>" . $count . "</td> <td>" . $row["NAME"] . "</td> <td>" . $row["QUANTITY"] . "</td> <td>" . $row["CITY"] . "</td> <td>" . $row["ADDRESS"] . "</td></tr>" . "<br>";
        //or just use "echo $row[0]"
    }
    echo "</table>";
}
?>
</form 
</p>
<!-- </form> -->

  <!-- at branch -->

  <!--- list ALL items -->