-
Notifications
You must be signed in to change notification settings - Fork 0
/
shopwithcookies.php
36 lines (31 loc) · 1.3 KB
/
shopwithcookies.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// We first require the connection from the base.php file
require 'reso/base.php';
include 'reso/classes/cartClass.php';
$cart = new Cart;
// We query the database in order to obtain the information about the products
if(isset($_GET['search']) && !empty($_GET['search'])){
$productquery = 'SELECT * FROM products WHERE title LIKE "%'.$_GET['search'].'%" OR author LIKE "%'.$_GET['search'].'%"';
} elseif(isset($_SESSION['product_filter']) && !empty($_SESSION['product_filter'])) {
$productquery = $_SESSION['product_filter'];
} else {
$productquery = 'SELECT * FROM products';
}
//get all the information from the sql database
$results = mysqli_query($con, $productquery);
$results = mysqli_fetch_all($results, MYSQLI_ASSOC);
//obtain the number of elements in our books table
$noResults = sizeof($results);
require 'reso/frames/header.php';
?>
<!-- Below starts the html for our document -->
<body>
<?php include 'reso/frames/navbarexperiment.php'; ?>
<?php include 'reso/frames/shopFrame.php'; ?>
<?php include 'reso/frames/footer.php'; ?>
<script type='text/javascript' src='reso/static/js/shop.js'></script>
<!--<script type='text/javascript' src='reso/static/js/cookies.js'></script> -->
<?php include 'reso/frames/cookieAdvert.php' ?>
<?php require 'reso/frames/scripts.php'; ?>
</body>
</html>