-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbooks.php
69 lines (49 loc) · 3.29 KB
/
books.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
<!DOCTYPE html>
<head><title>Books</title>
<link rel="stylesheet" href="css/books.css">
</head>
<body>
<div class="main">
<?php session_start();
$con = mysqli_connect("localhost","root","","swapshop_next");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
$sql="SELECT * FROM product_data WHERE category='book' ORDER BY price ASC";
if($result=mysqli_query($con,$sql))
{ if(mysqli_num_rows($result)>0)
{?>
<div class="table">
<h3><p>Category:- Books</p></h3><hr>
<table >
<?php
while ($row=mysqli_fetch_array($result))
{ $check=$row["deleted"];
if(isset($check)){}
else{ ?>
<tr>
<td class="text-center" ><a href="display.php?p_id=<?php echo $row['p_id']; ?>"><img src="img/<?php echo $row['image']; ?>" width="200px"></a></td>
<td class="text-center" ><p><b><a href="display.php?p_id=<?php echo $row['p_id']; ?>"><div style="text-transform:uppercase;"><?php echo $row['title']; ?></div></a></b></p>
<p><?php echo "Category: ".$row['category']; ?></p>
<p><b><?php echo "Price: ".$row['price']."/- </b><br>(In rupee)"; ?></p>
</tr>
<?php }
}?>
</table>
</div>
<?php
mysqli_free_result($result);
}
else
{
echo "No matching records are found";
}
}
}
?>
</div>
</body>
</html>