-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathborrowedbooks.php
More file actions
137 lines (127 loc) · 3.48 KB
/
borrowedbooks.php
File metadata and controls
137 lines (127 loc) · 3.48 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
<?php
session_start();
// Database configuration
$servername = "localhost:3307";
$username = "root";
$password = "venessa33";
$dbname = "librarymain";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (empty($_SESSION['email'])) {
echo "User not logged in.";
exit(); // Stop script execution if not logged in
}
$email = $conn->real_escape_string($_SESSION['email']);
$sql = "SELECT books.BookName, books.AuthorID, issuebook.dateissued
FROM issuebook
JOIN books ON issuebook.bookid = books.bookid
WHERE issuebook.email =?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $email); // Assuming email is a string
$stmt->execute();
$result = $stmt->get_result();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body{
align-items: center;
justify-content: center;
font-family: sans-serif;
background: #f3f3f3;
flex-direction: column;
margin: 0;
}
.header{
text-transform: uppercase;
font-family: 'Times New Roman', Times, serif;
text-align: center;
color:black;
font-style:italic;
background-color:lightblue;
margin-top:-45px;
height:80px;
padding-top:30px
}
.nav{
background-color:lightblue;
margin:
}
.nav a{
color:black;
display:inline-block;
text-align:center;
padding: 25px;
padding-left:100px;
}
.nav a:hover{
text-decoration: underline;
color:blue;
}
button{
background-color:brown;
border: none;
color:white;
text-align: center;
font-size:16px;
border-radius:20px;
padding:10px;
}
button:hover{
background-color:blueviolet;
}
table {
width: 100%;
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
th, td {
padding: 10px;
text-align: left;
}
</style>
</head>
<body>
<div class="header">
<h1> LIBRARY MANAGEMENT SYSTEM</h1>
</div>
<div class="nav">
<a href="userhomepage.php">DASHBOARD</a>
<a href="availablebooks.php">AVAILABLE BOOKS TO BORROW </a>
<a href="borrowedbooks.php"> ISSUED BOOKS</a>
<a href="userlogoutpage.php">
<button>Log Out</button>
</a>
</div>
<div>
<h1>Borrowed Books</h1>
</div>
<table>
<tr>
<th>Title</th>
<th>Author</th>
<th>Issue Date</th>
</tr>
<?php
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>{$row['BookName']}</td>
<td>{$row['AuthorID']}</td>
<td>{$row['dateissued']}</td>
</tr>";
}
} else {
echo "<tr><td colspan='3'>No books issued</td></tr>";
}
?>
</table>
</body>
</html>