-
Notifications
You must be signed in to change notification settings - Fork 1
/
products.php
158 lines (127 loc) · 3.04 KB
/
products.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
include 'config.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MM Granites</title>
<link rel="apple-touch-icon" sizes="180x180" href="assets/img/logo-32.png">
<link rel="icon" type="image/png" href="assets/img/logo-32.png" sizes="32x32">
<link rel="icon" type="image/png" href="assets/img/logo-32.png" sizes="16x16">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/css_product.css">
<link rel="stylesheet" type="text/css" href="css/header-footer.css">
</head>
<body>
<?php
include 'header.php';
?>
<section style="background-image: url('assets/img/products.jpg');height:150px ">
<div class="container-fluid" id="product_banner">
<div class="row">
<div class="col-sm-3">
<h1 style="color: white;margin-top:50px">Products</h1>
<h5 ><a style="color: white;text-decoration: none" href="index.php">Home /</a><a style="color: white;text-decoration: none" href="#">Products</a>
</h5>
</div>
</div>
</div>
</section>
<section>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="jumbo">
<center><h4>Our Products are Our Main Strength</h4></center>
</div>
</div>
</div>
</div>
</section>
<section style="margin-top: 30px;">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<?php
include 'config.php';
if(isset($_GET['page']))
{
$page=$_GET['page'];
if($page==""||$page==1)
{
$p=0;
}
else
{
$p=$page;
$p=($p-1)*8;
}
$q="SELECT * FROM `products` LIMIT $p,8";
}
else
{
$q="SELECT * FROM `products` LIMIT 0,8";
}
$d=mysqli_query($dbcon,$q);
while($res=mysqli_fetch_array($d))
{
?>
<div class=" col-sm-3" style="height: 300px;">
<figure>
<a href="product-details.php?prod_id=<?php echo $res['id']; ?>">
<img src="admin/<?php echo $res['image']; ?>" style="height: 150px;width: 100%">
</a>
<figcaption>
<a href="product-details.php?prod_id=<?php echo $res['id']; ?>">
<h3><?php
if(strlen($res['name']) > 20)
echo substr($res['name'],0,20)."...";
else
echo $res['name'];
?></h3>
</a>
<p>
<?php
if(strlen($res['brief']) > 120)
echo substr($res['brief'],0,120)."...";
else
echo $res['brief'];
?>
<br>
<br>
</p>
</figcaption>
</figure>
</div>
<?php
}
?>
</div>
</div>
<div class="container-fluid">
<?php
$query1=mysqli_query($dbcon,"SELECT * FROM `products` ");
$row=mysqli_num_rows($query1);
$row=$row/8;
$row1=ceil($row);
?>
</div>
<div class="jumbo" style="margin-top: 0px;">
<strong>Page:</strong>
<?php
for($i=1;$i<=$row1;$i++)
{
?>
<a style="text-decoration: none" href="products.php?page=<?php echo $i; ?>"> <?php echo $i ; ?> </a>
<?php
}
?>
</div>
</section>
<?php
include 'footer.php';
?>
</body>
</html>