-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.php
212 lines (190 loc) · 8.14 KB
/
view.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php include "components/footer.php" ?>
<?php include "components/navbar.php" ?>
<?php include "components/book.php" ?>
<?php
$conn=mysqli_connect('localhost','root','','bookbae');
if (isset ($_REQUEST['isbn'])){
$isbn=$_REQUEST['isbn'];
}
$sql="select * from books where isbn=$isbn";
$data=$conn->query($sql);
$row=$data->fetch_array();
$author=$row['author'];
$category=$row['category'];
$sql2="SELECT isbn FROM books WHERE category=\"$category\" AND isbn!=\"$isbn\" LIMIT 0,4";
$relatedBooks=$conn->query($sql2);
$row2=$relatedBooks->fetch_array();
//book images
$images = $conn->query("SELECT * FROM book_images WHERE isbn=\"$isbn\"");
function showImages(){
global $images;
foreach($images as $i => $image){
$imageName = $image["image"];
$imageElement = "
<div class='col-6 d-flex justify-content-center'>
<div class='card' style='width: 13rem;'>
<img src='data/".$imageName."' class='card-img-top' alt='book image'>
</div>
</div>
";
echo $imageElement;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- custom css -->
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/view.css">
<!-- bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"></link>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<title>BookBae | View </title>
</head>
<body>
<!-- Navbar starts -->
<?php navbar(""); ?>
<!-- Navbar ends -->
<!-- Page content starts -->
<h2 class="text-center p-3 animate__animated animate__slideInDown"><strong><?php echo $row['name']; ?></strong></h2>
<div class="container-fluid pb-5">
<div class="row mt-3">
<div class="col-lg-6 justify-content-end">
<div class="row justify-content-center">
<?php showImages(); ?>
</div>
</div>
<!-- Page description-->
<div class="col-lg-6">
<div class="container description mx-auto">
<div class="row ">
<div class="col-6">
ISBN
</div>
<div class="col-6">
<?php echo $isbn; ?>
</div>
</div>
<div class="row">
<div class="col-6">
Author
</div>
<div class="col-6">
<?php echo $row['author']; ?>
</div>
</div>
<div class="row justify-content-center">
<div class="col-6 ">
Language
</div>
<div class="col-6">
<?php echo $row['language']; ?>
</div>
</div>
<div class="row justify-content-center">
<div class="col-6 ">
Year
</div>
<div class="col-6">
<?php echo $row['year']; ?>
</div>
</div>
<div class="row justify-content-center">
<div class="col-6 ">
Category
</div>
<div class="col-6">
<?php echo $row['category']; ?>
</div>
</div>
<div class="row justify-content-center">
<div class="col-6 ">
Edition
</div>
<div class="col-6">
<?php echo $row['edition']; ?>
</div>
</div>
<div class="row justify-content-center">
<div class="col-6 ">
Publisher
</div>
<div class="col-6">
<?php echo $row['publisher']; ?>
</div>
</div>
<div class="row justify-content-center pt-2">
<div class="col-6 ">
Price
</div>
<div class="col-6 ">
<strong>LKR<?php echo $row['price']; ?>.00</strong>
</div>
</div>
<div class="row pt-2 favourite col-12">
<a href="php/addToFavourite?isbn=<?php echo $isbn; ?>&favSubmit=true" class="d-flex justify-content-center" > <button class="btn btn-primary" type="submit" ><i class="bi bi-heart-fill p-1"></i>Add to favourites</button></a>
</div>
<form action="php/addToCart.php?isbn=<?php echo $isbn; ?>" method="post" target="_blank">
<div class="row d-flex justify-content-center pt-2">
<div class="col-3 d-flex">
<input type="text" placeholder="Qty" name="quantity">
</div>
<div class="col-5 d-flex">
<button class="btn btn-primary" type="submit" name="addCart"><i class="bi bi-cart3 p-1"></i>Add to cart</button>
</div>
<div class="col-4 d-flex">
<button class="btn btn-primary" type="submit" name="buyNow"><i class="bi bi-wallet-fill p-1"></i>Buy now</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Page description -->
<div class="container about pt-2 pb-2 <?php echo empty($row['description'])?'d-none':''; ?>">
<div class="row justify-content-center align-content-center">
<div class="col-10 ">
<h4><strong>Description</strong></h4>
<p><?php echo $row['description']; ?></p>
</div>
</div>
</div>
<!--related items -->
<div class="container related-items">
<section class="container-fluid my-5">
<h3 class="mb-1">Related products</h3>
<div class="mb-4 hr"></div>
<div class="row">
<?php
foreach($relatedBooks as $book){
book($book['isbn'],3);
}
?>
</div>
</section>
</div>
<div class="container gif mx-auto p-5 m-3">
<div class="row align-items-center">
<div class="col-md-6 ">
<img src="assets/images/view page/gif.gif" class="card-img-top" alt="...">
</div>
<div class="col-md-6 p-4 ">
<p>"Books are the quietest and most constant of friends; they are the most accessible and wisest of counselors, and the most patient of teachers."</p>
<p>-Charles W. Eliot</p>
</div>
</div>
</div>
</div>
<!-- Page content ends -->
<!-- Footer starts -->
<?php footer(); ?>
<!-- Footer ends -->
</body>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- <script src="js/view.js"></script> -->
</html>