-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
102 lines (81 loc) · 2.29 KB
/
delete.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
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
table,th,td{
border: 0.5px solid black;
padding:1em;
}
</style>
</head>
<body>
<ul>
<li><a href="#list">List</a></li>
<li class="dropdown">
<a href="javascript:void(0)" class="dropbtn">Books</a>
<div class="dropdown-content">
<a href="index.php">ADD</a>
<a href="#">Delete</a>
</div>
</li>
<li><a href="#contact">Issue</a></li>
</ul>
<header>
<h2>List</h2>
</header>
<p>List of all Books</p>
<?php
include("connection.php");
$result = mysqli_query($conn, "SELECT * FROM book_master ORDER BY book_id ASC"); // using mysqli_query instead
//while($res = mysql_fetch_array($result)) { // mysql_fetch_array is deprecated, we need to use mysqli_fetch_array
echo "<table><tr><th>ID</th><th>Name</th><th>Author</th><th>Publisher</th><th>Edition</th><th>ISBN</th><th>Price</th><th>Copies</th><th>Delete</th></tr>";
while($res = mysqli_fetch_array($result)) {
echo "<tr><td>" . $res["book_id"]. "</td><td>" . $res["book_title"]. "</td><td> " . $res["author"]. "</td><td> " . $res["publisher"]. "</td><td> " . $res["edition"]. "</td><td> " . $res["ISBN"].
"</td><td> " . $res["price"]. "</td><td> " . $res["copies"]. "</td><td> <a href=\"delete1.php?book_id=$res[book_id]\" onClick=\"return confirm('Are you sure you want to delete?')\">Delete</a></td></tr>";
}
echo "</table>";
?>
</body>
</html>