-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.php
118 lines (96 loc) · 3.45 KB
/
stats.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
<?php
/**
* Created by PhpStorm.
* User: tugceakin
* Date: 11/13/15
* Time: 2:12 AM
*/
$dsn = 'mysql:host=localhost;dbname=online_market';
$username = 'root';
$password = 'password';
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$db = new PDO($dsn, $username, $password, $options);
//$query = "SELECT * FROM Products";
//$products = $db->query($query)->fetchAll();
$company = "";
if(isset($_GET['company'])){
$company = $_GET['company'];
}
if($company == "cycles"){
$company = "Shunur Cycles";
$query = "SELECT * FROM Products WHERE company = '$company'";
$products = $db->query($query)->fetchAll();
}else if($company == "arcadia"){
$company = "Arcadia";
$query = "SELECT * FROM Products WHERE company = '$company'";
$products = $db->query($query)->fetchAll();
}
else if($company == "fast_food"){
$company = "Yummy Tummy Fast Food";
$query = "SELECT * FROM Products WHERE company = '$company'";
$products = $db->query($query)->fetchAll();
}else if($company == "discover_istanbul"){
$company = "Discover Istanbul";
$query = "SELECT * FROM Products WHERE company = '$company'";
$products = $db->query($query)->fetchAll();
}else if($company == "footprints_preschool"){
$company = "Footprints Preschool";
$query = "SELECT * FROM Products WHERE company = '$company'";
$products = $db->query($query)->fetchAll();
}
else{
$query = "SELECT * FROM Products";
$products = $db->query($query)->fetchAll();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.5/flatly/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="lib/lib/jquery.dataTables.min.css" />
<link rel="stylesheet" href="lib/lib/main.css" />
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<?php include("view/navigation.php"); ?>
<div class="container">
<div class="fb-like" data-href="http://localhost:63342/termproj272/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
<table class="table products-table table-hover table-striped">
<thead>
<tr>
<th>Name</th>
<th>Company</th>
<th>Price</th>
<th>Visit Count</th>
</tr>
</thead>
<tbody>
<?php
foreach($products as $p):?>
<tr>
<!-- <td><a href="?action=view_product&product_id=--><?php //echo $p['id']; ?><!--">--><?php //echo $p['title'];?><!--</a></td>-->
<td><a href="product.php?product_id=<?php echo $p['id']; ?>"><?php echo $p['title'];?></a></td>
<td><?php echo $p['company'];?></td>
<td><?php echo $p['price'];?></td>
<td><?php echo $p['visit_count'];?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<script src="lib/lib/jquery/dist/jquery.min.js")"></script>
<script src="lib/lib/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="lib/lib/DataTables-1.10.7/media/js/jquery.dataTables.min.js"></script>
<script src="lib/lib/main.js"></script>
<?php //include 'view/header.php'; ?>
<!---->
<?php //include 'view/footer.php'; ?>
</body>
</html>