Repository navigation
Expand file tree
/
Copy pathShop.php
More file actions
85 lines (67 loc) · 2.39 KB
/
Copy pathShop.php
File metadata and controls
85 lines (67 loc) · 2.39 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
include_once 'lib/DBHelper.php';
include_once 'lib/Coffee.php';
$dbh = new DBHelper();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/AutoGrid.css" rel="stylesheet" type="text/css">
<link href="css/Header.css" rel="stylesheet" type="text/css">
<link href="css/StarRating.css" rel="stylesheet" type="text/css">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
</style>
</head>
<body>
<?php
session_start();
$_SESSION['ref'] = $_SERVER['SCRIPT_NAME'];
session_write_close();
?>
<!-- MAIN (Center website) -->
<!--**************************************************************************
Header starts here. It contains Logo and 3 navigation links.
****************************************************************************-->
<?php include 'Header.php'; ?>
<div class="row">
</div>
<div class="row">
<h2>Current Inventory</h2>
</div>
<?php
//Step2
$query = "SELECT * FROM `Coffee` ORDER BY country, name ASC";
//Step3
$result = $dbh->query($query);
$fields = mysqli_fetch_fields($result);
?>
<!-- Portfolio Gallery Grid -->
<div class="container">
<?php while ($row = mysqli_fetch_array($result)) {
$coffee = Coffee::fromRow($row);
?>
<div class="cell">
<a href= "ShowCoffee.php?productCode=<?php echo urlencode($row['productCode']);?>">
<div class="star-ratings-css" style="width: 135px; margin-bottom: 10px">
<div class="star-ratings-css-top" style="width: <?php echo $coffee->avgRating*20;?>%">
<span>★</span><span>★</span><span>★</span><span>★</span><span>★</span>
</div>
<div class="star-ratings-css-bottom"><span>★</span><span>★</span><span>★</span><span>★</span><span>★</span></div>
</div>
<span class="data"> <img src="<?php echo $coffee->thumbnail;?>" alt="<?php $coffee->name ?>" style="width:100%"></span>
<span class="data"> <h3><?php echo $coffee->country, ' ', $coffee->name ?></h3></span>
</a>
</div>
<?php } ?>
</div>
<!-- END MAIN -->
<?php
//Step 4
$dbh->close();
?>
</body>
</html>