-
Notifications
You must be signed in to change notification settings - Fork 2
/
display_book.php
64 lines (60 loc) · 1.34 KB
/
display_book.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
<?PHP
session_start();
$state = $_SESSION['state'];
$slevel = $_SESSION['slevel'];
if(!($state="logged in" && ($slevel==1||$slevel==2)))
{
session_destroy();
header('location:login.php?code=1');
}
else
{
if(isset($_POST['return']))
header('location:lib_home.php');
}
?>
<html>
<head>
<title>
Book List
</title>
<link rel="stylesheet" type="text/css" href="style/common.css">
<link rel="stylesheet" type="text/css" href="style/display_lists.css">
</head>
<body>
<div class="main_div">
<center>
<table class="large">
<tr>
<th> Book ID </th>
<th> Name </th>
<th> Number of Copies </th>
<th></th>
</tr>
<?PHP
$con = new mysqli("localhost","root","","lib_man");
$com = "select * from books;";
$res = mysqli_query($con,$com);
while($row= mysqli_fetch_array($res))
{
?>
<tr>
<td> <?PHP echo $row[0] ?> </td>
<td> <?PHP echo $row[1] ?> </td>
<td> <?PHP echo $row[2] ?> </td>
<td style="background-color:rgba(200,0,0,0.7);"> <a href="edit_book_details.php?id=<?PHP echo $row[0]?>"> Edit Details </a></td>
</tr>
<?PHP
}
?>
</table>
<br><br>
<div class="hr"></div>
<form method="post">
<input type="submit" name="return" value="Return to Menu">
<div class="hr"></div>
</form>
</center>
</div>
</body>
</html>