-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcar-listing.php
197 lines (183 loc) · 9.31 KB
/
car-listing.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?php
session_start();
include('includes/config.php');
error_reporting(0);
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Car Rental Portal | Car Listing</title>
<!--Bootstrap -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css" type="text/css">
<!--Custome Style -->
<link rel="stylesheet" href="assets/css/style.css" type="text/css">
<!--FontAwesome Font Style -->
<link href="assets/css/font-awesome.min.css" rel="stylesheet">
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/images/favicon-icon/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/images/favicon-icon/apple-touch-icon-114-precomposed.html">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/images/favicon-icon/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="assets/images/favicon-icon/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="assets/images/favicon-icon/favicon.png">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet">
</head>
<body>
<!--Header-->
<?php include('includes/header.php');?>
<!-- /Header -->
<!--Page Header-->
<section class="page-header listing_page">
<div class="container">
<div class="page-header_wrap">
<div class="page-heading">
<h1>Car Listing</h1>
</div>
<ul class="coustom-breadcrumb">
<li><a href="#">Home</a></li>
<li>Car Listing</li>
</ul>
</div>
</div>
<!-- Dark Overlay-->
<div class="dark-overlay"></div>
</section>
<!-- /Page Header-->
<!--Listing-->
<section class="listing-page">
<div class="container">
<div class="row">
<div class="col-md-9">
<div class="result-sorting-wrapper">
<?php
//Query for Listing count
$sql = "SELECT id FROM tblvehicles";
$query = $dbh->prepare($sql);
$query->execute();
$cnt = $query->rowCount();
?>
<p><span><?php echo htmlentities($cnt);?> Listings</span></p>
</div>
<?php
$sql = "SELECT tblvehicles.*, tblbrands.BrandName
FROM tblvehicles
JOIN tblbrands
ON tblbrands.id=tblvehicles.VehiclesBrand";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
if($query->rowCount() > 0) {
foreach($results as $result) { ?>
<div class="product-listing-m gray-bg">
<div class="product-listing-img">
<img src="admin/img/vehicleimages/<?php echo htmlentities($result->Vimage1);?>" class="img-responsive" alt="Image">
</div>
<div class="product-listing-content">
<h5><a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?>"><?php echo htmlentities($result->BrandName);?> , <?php echo htmlentities($result->VehiclesTitle);?></a></h5>
<p class="list-price">$<?php echo htmlentities($result->PricePerDay);?> Per Day</p>
<ul>
<li><i class="fa fa-user" aria-hidden="true"></i><?php echo htmlentities($result->SeatingCapacity);?> seats</li>
<li><i class="fa fa-calendar" aria-hidden="true"></i><?php echo htmlentities($result->ModelYear);?> model</li>
<li><i class="fa fa-car" aria-hidden="true"></i><?php echo htmlentities($result->FuelType);?></li>
</ul>
<a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?>" class="btn">View Details <span class="angle_arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></span></a>
</div>
</div>
<?php }} ?>
</div>
<!--Side-Bar-->
<aside class="col-md-3">
<div class="sidebar_widget">
<div class="widget_heading">
<h5><i class="fa fa-filter" aria-hidden="true"></i> Find Your Car</h5>
</div>
<div class="sidebar_filter">
<form action="search-carresult.php" method="post">
<div class="form-group select">
<select class="form-control" name="brand">
<option>Select Brand</option>
<?php
$sql = "SELECT * FROM tblbrands";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
if($query->rowCount() > 0) {
foreach($results as $result) { ?>
<option value="<?php echo htmlentities($result->id);?>"><?php echo htmlentities($result->BrandName);?></option>
<?php }} ?>
</select>
</div>
<div class="form-group select">
<select class="form-control" name="fueltype">
<option>Select Fuel Type</option>
<option value="Petrol">Petrol</option>
<option value="Diesel">Diesel</option>
<option value="CNG">CNG</option>
</select>
</div>
<div class="form-group">
<button type="submit" class="btn btn-block"><i class="fa fa-search" aria-hidden="true"></i> Search Car</button>
</div>
</form>
</div>
</div>
<div class="sidebar_widget">
<div class="widget_heading">
<h5><i class="fa fa-car" aria-hidden="true"></i> Recently Listed Cars</h5>
</div>
<div class="recent_addedcars">
<ul>
<?php
$sql = "SELECT tblvehicles.*, tblbrands.BrandName
FROM tblvehicles
JOIN tblbrands
ON tblbrands.id=tblvehicles.VehiclesBrand
ORDER BY id DESC
LIMIT 4";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
if($query->rowCount() > 0) {
foreach($results as $result) { ?>
<li class="gray-bg">
<div class="recent_post_img">
<a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?>">
<img src="admin/img/vehicleimages/<?php echo htmlentities($result->Vimage1);?>" alt="image">
</a>
</div>
<div class="recent_post_title">
<a href="vehical-details.php?vhid=<?php echo htmlentities($result->id);?>">
<?php echo htmlentities($result->BrandName);?> , <?php echo htmlentities($result->VehiclesTitle);?>
</a>
<p class="widget_price">$<?php echo htmlentities($result->PricePerDay);?> Per Day</p>
</div>
</li>
<?php }} ?>
</ul>
</div>
</div>
</aside>
<!--/Side-Bar-->
</div>
</div>
</section>
<!-- /Listing-->
<!--Footer -->
<?php include('includes/footer.php');?>
<!-- /Footer-->
<!--Back to top-->
<div id="back-top" class="back-top"> <a href="#top"><i class="fa fa-angle-up" aria-hidden="true"></i> </a> </div>
<!--/Back to top-->
<!--Login-Form -->
<?php include('includes/login.php');?>
<!--/Login-Form -->
<!--Register-Form -->
<?php include('includes/registration.php');?>
<!--/Register-Form -->
<!--Forgot-password-Form -->
<?php include('includes/forgotpassword.php');?>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/interface.js"></script>
</body>
</html>