-
Notifications
You must be signed in to change notification settings - Fork 0
/
topselling.php
59 lines (46 loc) · 1.56 KB
/
topselling.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
<?php include 'includes/session.php'; ?>
<?php include 'includes/header.php'; ?>
<body class="hold-transition layout-top-nav">
<div class="wrapper">
<?php include 'includes/navbar.php'; ?>
<div class="content-wrapper">
<div class="container" style="width: 1200px;" >
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-sm-12">
<ul id="trending">
<?php
$now = date('Y-m-d');
$conn = $pdo->open();
$stmt = $conn->prepare("SELECT * FROM products WHERE date_view=:now ORDER BY counter DESC LIMIT 10");
$stmt->execute(['now'=>$now]);
foreach($stmt as $row){
$image = (!empty($row['photo'])) ? 'images/'.$row['photo'] : 'images/noimage.jpg';
echo "
<div class='col-sm-4'>
<div class='box box-solid'>
<div class='box-body prod-body'>
<img src='".$image."' width='100%' height='230px' class='thumbnail'>
<h5><a href='product.php?product=".$row['slug']."'>".$row['name']."</a></h5>
</div>
<div class='box-footer'>
<b style=' float: right;'>$ ".number_format($row['price'], 2)."</b>
</div>
</div>
</div>
";
}
$pdo->close();
?>
<ul>
</div>
</div>
</section>
</div>
</div>
<?php include 'includes/footer.php'; ?>
</div>
<?php include 'includes/scripts.php'; ?>
</body>
</html>