-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsellerpage.php
More file actions
139 lines (89 loc) · 2.93 KB
/
sellerpage.php
File metadata and controls
139 lines (89 loc) · 2.93 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>About</title>
</head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');
</style>
<style>
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@500&display=swap');
</style>
<link rel="stylesheet" href="src/style.css" />
<link rel="stylesheet" href="/src/responsive.css">
<body>
<?php
include 'header.php'
?>
<!-- about company ,location , telephone , mail address , staffnames and picture -->
<!-- banner image -->
<div class="banner_wrap">
<div class="banner_container">
<div class="overlay"></div>
<div class="container">
<h1>Seller Page</h1>
</div>
</div>
</div>
<!-- dummy cars -->
<!-- search button -->
<div class="container_search">
<h2>Car Search</h2>
<form action="searchcar.php" method="POST">
<div>
<label for="model">Model:</label>
<input type="text" id="model" name="model" required placeholder="Enter car model">
</div>
<div>
<label for="location">Location:</label>
<input type="text" id="location" name="location" required placeholder="Enter location">
</div>
<button type="submit">Search</button>
</form>
</div>
<div class="car_container">
<h2 class="heading">Car for sell</h2>
<div class="cars_wrap">
<?php
$connect = mysqli_connect('localhost', 'root', '', 'carselling');
// Check the database connection
if (!$connect) {
die("Connection failed: " . mysqli_connect_error());
}
$query = "SELECT * FROM newcars";
$result = mysqli_query($connect, $query);
// Check for query execution errors
if (!$result) {
die("Query failed: " . mysqli_error($connect));
}
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$carmodel = $row["carmodel"];
$carmake = $row["carmake"];
$carprice = $row["carprice"];
$carlocation = $row["carlocation"];
echo '
<div class="single_Car">
<div class="about_Car">
<div class="car_model"><h2>' . $carmake . '</h2></div>
<div class="car_model"><h4>' . $carmodel . '</h4></div>
<div class="car_price">$' . $carprice . '</div>
<div class="car_location">' . $carlocation . '</div>
</div>
</div>';
}
} else {
echo 'There are no new cars in your database';
}
// Close the database connection
mysqli_close($connect);
?>
</div>
</div>
<!-- dumy cards ends -->
<!-- script -->
<script src="./src/app.js"></script>
</body>
</html>