Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "header.php";
- ?>
- <div class="container">
- <div class="row">
- <div class = "col-12 m-top-2p">
- <form method="get" action="zoek.php">
- <?php
- # Querying for existing categories of items
- $query = $conn->prepare("SELECT StockGroupID, StockGroupName FROM stockgroups");
- $query->execute();
- $rowcounter = 0;
- # If the row exists of four, start new row of filters
- while($row = $query->fetch()) {
- if ($rowcounter % 4 == 0) {
- }
- print("<button type=submit name=prodgroup class='btn btn-primary knopenZoekenFilters' value=".$row['StockGroupID'].">".$row['StockGroupName']."</button> \n");
- $rowcounter++;
- }
- ?>
- </form>
- </div>
- </div>
- <div class="row">
- <div class="col-12">
- <div id="search">
- <form method="get" action="zoek.php">
- <input type="text" name="producttitle" placeholder="Productnaam">
- <input type=submit class="btn btn-primary" value="Zoek...">
- </form>
- </div>
- </div>
- </div>
- </div>
- <div class="container">
- <div class="row m-top-5p">
- <!--<div class="col-12 m-top-5p">-->
- <?php
- if (isset($_GET['prodgroup']) && $_GET['prodgroup'] != ""){
- $category = $_GET['prodgroup'];
- # Query for looking up items bound to the groupID
- $query = $conn->prepare("
- SELECT S.StockItemID, S.StockItemName, S.Photo, S.UnitPrice, S.Photo, S.Brand
- FROM stockitems S JOIN stockitemstockgroups SISG ON S.StockItemID = SISG.StockItemID
- JOIN stockgroups SG ON SISG.StockGroupID = SG.StockGroupID
- WHERE SG.StockGroupID = ?
- ");
- $query->execute(array($category));
- $rowcounter = 0;
- while($row = $query->fetch()) {
- /**
- if ($rowcounter == 0) {
- print("<div class=row>");
- } elseif ($rowcounter % 4 == 0) {
- print("</div>");
- print("<div class=row>");
- }**/
- $prijs = $row['UnitPrice'];
- $naam = $row['StockItemName'];
- ?>
- <div class="col-12 col-md-6 col-lg-3" style="margin-top: 25px;">
- <img src="include/images/neon.jpg" width="100%" alt=""/>
- <p class="prijspoductZoeken">€<?php echo $prijs; ?></p>
- <p><?php echo $naam; ?></p>
- <form method="get" action="productinfo.php" class="addToCart">
- <button type="submit" class="btn btn-primary" name="product" value="<?php print($row['StockItemID']); ?>">Bekijken</button>
- </form>
- </div>
- <?php
- $rowcounter++;
- }
- } elseif (isset($_GET['producttitle']) && $_GET['producttitle'] != "") {
- $like = "%".$_GET['producttitle']."%";
- $query = $conn->prepare("SELECT S.StockItemID, S.StockItemName, S.Photo, S.UnitPrice, S.Photo FROM stockitems S WHERE StockItemName LIKE ?");
- $query->execute(array($like));
- $rowcounter = 0;
- while($row = $query->fetch()) {
- /**
- if ($rowcounter == 0) {
- print("<div class=row>");
- } elseif ($rowcounter % 4 == 0) {
- print("</div>");
- print("<div class=row>");
- }**/
- $prijs = $row['UnitPrice'];
- $naam = $row['StockItemName'];
- ?>
- <div class="col-12 col-md-6 col-lg-3" style="margin-top: 25px;">
- <img src="include/images/neon.jpg" width="100%" alt=""/>
- <p class="prijspoductZoeken">€<?php echo $prijs; ?></p>
- <p><?php echo $naam; ?></p>
- <form method="get" action="productinfo.php" class="addToCart">
- <button type="submit" class="btn btn-primary" name="product" value="<?php print($row['StockItemID']); ?>">Bekijken</button>
- </form>
- </div>
- <?php
- $rowcounter++;
- }
- }
- ?>
- <!--</div>-->
- </div>
- </div>
- <?php
- include "footer.php"
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement