-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
95 lines (85 loc) · 3.57 KB
/
index.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
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
86
87
88
89
90
91
92
93
94
95
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "";
try{
$conn = mysqli_connect($servername, $username, $password,'project2');
// echo "Connected successfully";
$sql = "SELECT * FROM PRODUCT_CARD";
$result = mysqli_query($conn, $sql);
$products = mysqli_fetch_all($result, MYSQLI_ASSOC);
mysqli_close($conn);
// foreach($products as $product){
// echo htmlspecialchars($product["NAME"]);
// }
}
catch (PDOException $e){
echo $e->getMessage();
}
?>
<!DOCTYPE html>
<html>
<!-- BEGIN HEADER -->
<?php echo file_get_contents("header.html"); ?>
<!-- END HEADER -->
<!-- BEGIN MIDDLE SECTION -->
<div class="grid-container">
<!-- BEGIN LEFT NAVIGATION PANEL -->
<div class="left" id="left-nav">
<header>SHOP</header>
<a class="left-nav" href="#fish-food">FISH FOOD</a>
<a class="left-nav" href="#live-fish">LIVE FISH</a>
</div>
<!-- END LEFT NAVIFATION PANEL -->
<div class="middle">
<!-- BEGIN FISH FOOD CATEGORY -->
<div class="product-header" id="fish-food">FISH FOOD</div>
<div class="product">
<?php foreach($products as $product){ ?>
<?php if (strpos($product['PATH'], "fish-food")){ ?>
<div class="product-card">
<a href="product-page.php?val=<?php echo $product['PRODUCT_ID']; ?>">
<div>
<img src="<?php echo $product['PATH']; ?>" style="<?php echo $product['DIMENSION']; ?>">
<product-name><?php echo htmlspecialchars($product['NAME']); ?></product-name>
<product-price><?php echo htmlspecialchars($product['PRICE']); ?></product-price>
<product-description><?php echo htmlspecialchars($product['DESCRIPTION']); ?>
</product-description>
<product-description><?php echo htmlspecialchars($product['WEIGHT']); ?></product-description>
<p><button>More Details</button></p>
</div>
</a>
</div>
<?php } ?>
<?php } ?>
</div>
<!-- END FISH FOOD CATEGORY -->
<!-- BEGIN LIVE FISH CATEGORY -->
<div class="product-header" id="live-fish">LIVE FISH</div>
<div class="product">
<?php foreach($products as $product){ ?>
<?php if (strpos($product['PATH'], "live-fish")){ ?>
<div class="product-card">
<a href="product-page.php?val=<?php echo $product['PRODUCT_ID']; ?>">
<div>
<img src="<?php echo $product['PATH']; ?>" style="<?php echo $product['DIMENSION']; ?>">
<product-name><?php echo htmlspecialchars($product['NAME']); ?></product-name>
<product-price><?php echo htmlspecialchars($product['PRICE']); ?></product-price>
<product-description><?php echo htmlspecialchars($product['DESCRIPTION']); ?>
</product-description>
<product-description><?php echo htmlspecialchars($product['WEIGHT']); ?></product-description>
<p><button>More Details</button></p>
</div>
</a>
</div>
<?php } ?>
<?php } ?>
</div>
<!-- END LIVE FISH CATEGORY -->
</div>
</div>
<!-- END MIDDLE SECTION -->
<!-- BEGIN FOOTER -->
<?php echo file_get_contents("footer.html"); ?>
<!-- END FOOTER -->
</html>