-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoption_book.php
162 lines (159 loc) · 7.93 KB
/
option_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
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
<!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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style-home.css">
<link rel="stylesheet" href="style-ltdg.css">
<link rel="stylesheet" href="style-table.css">
<link rel="stylesheet" href="style-option.css">
<script src="jsbaocao.js" defer></script>
<title>Xem thông tin sách</title>
</head>
<body>
<div class="option">
<div class="header">
<ul class="container-main">
<li class="select">
<a href="index-home.php">
<i class="fas fa-home"></i>
Trang chủ
</a>
</li>
<li class="select"><a href="lapthedocgia.php" class="register">Quản lí độc giả</a></li>
<li class="select"><a href="tiepnhansachmoi.php" class="newbooks">Quản lí sách</a></li>
<li class="select"><a href="tracuusach.php" class="tracuusach">Tra cứu sách</a></li>
<li class="select"><a href="sachmuon.php">Mượn sách</a></li>
<li class="select"><a href="trasach.php">Trả sách</a></li>
<li class="select"><a href="phieuthutienphat.php">Phiếu thu tiền phạt</a></li>
<li class="select">
<a class="jsdownBC">Lập báo cáo <i class="fas fa-caret-down"></i></a>
<ul class="downBC action">
<li><a href="BCMStheloai.php">Mượn sách theo thể loại</a></li>
<li><a href="BCsachtratre.php">Sách trả trễ</a></li>
</ul>
</li>
<li class="select">
<a href="option.php">
Cài đặt
</a>
</li>
</ul>
</div>
</div>
<div class="main">
<div class=" divContent">
<div class="book">
<h2>Mã sách: <?php echo $_GET['GetID']; ?></h2>
<table id="resultSearchBook">
<thead>
<th>Tên đầu sách</th>
<th>Tác giả</th>
<th>Thể loại</th>
<th>Nhà xuất bản</th>
<th>Năm xuất bản</th>
<th>Số lượng nhập</th>
<th>Giá tiền</th>
</thead>
<?php
$masach = $_GET['GetID'];
$conn = mysqli_connect('localhost', 'root', '', 'quanlythuvien') or die ('fail');
if(mysqli_connect_errno()){
echo "failed to connect to Mysql: ".mysqli_connect_error();
exit();
}
$sql = "SELECT DISTINCT dausach.MaDauSach, sach.MaSach, TenDauSach, TenTacGia, TenTheLoai, NhaXuatBan, NamXuatBan, SoLuong, GiaTien
FROM dausach INNER JOIN sach ON dausach.MaDauSach = sach.MaDauSach
INNER JOIN ct_tacgia ON dausach.MaDauSach=ct_tacgia.MaDauSach
INNER JOIN tacgia ON ct_tacgia.MaTacGia=tacgia.MaTacGia
INNER JOIN theloai ON dausach.MaTheLoai=theloai.MaTheLoai
INNER JOIN cuonsach ON sach.masach=cuonsach.masach
WHERE sach.MaSach=$masach";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
?>
<tr>
<td class="tendausach"><?php echo $row["TenDauSach"]; ?></td>
<td class="tg">
<?php
$mads = $row["MaDauSach"];
$tg = "SELECT TenTacGia FROM tacgia INNER JOIN ct_tacgia ON ct_tacgia.MaTacGia=tacgia.MaTacGia WHERE ct_tacgia.MaDauSach=$mads";
$res_tg = mysqli_query($conn, $tg);
if(mysqli_num_rows($res_tg) > 0){
while($row_tg = mysqli_fetch_assoc($res_tg)){
?>
<p><?php echo $row_tg["TenTacGia"]; ?></p>
<?php
}
}
?>
</td>
<td class="tl"><?php echo $row["TenTheLoai"]; ?></td>
<td class="nhaxb"><?php echo $row["NhaXuatBan"]; ?></td>
<td class="namxb"><?php echo $row["NamXuatBan"]; ?></td>
<td class="sl"><?php echo $row["SoLuong"]; ?></td>
<td class="gt"><?php echo $row["GiaTien"]; ?></td>
</tr>
</table>
<br>
<table id="resultSearchBook">
<h2>Thông tin cuốn sách</h2>
<thead>
<th>STT</th>
<th>Mã cuốn sách</th>
<th>Tình trạng</th>
</thead>
<br>
<tbody>
<?php
$masach = $_GET['GetID'];
$sql = "SELECT DISTINCT * FROM cuonsach WHERE MaSach=$masach";
$result = mysqli_query($conn, $sql);
$index=1;
if(mysqli_num_rows($result) > 0){
$damuon = 0;
while ($row = mysqli_fetch_assoc($result)){
if($row["TinhTrang"]==0) $tinhtrang="Chưa mượn";
else {
$damuon++;
$tinhtrang = "Đã mượn";
}
?>
<tr>
<td class="stt"><?php echo $index ?></td>
<td class="macuonsach"><?php echo $row["MaCuonSach"] ?></td>
<td class="tinhtrang"><?php echo $tinhtrang; ?></td>
</tr>
<?php
$index=$index+1;
}
}
?>
<h4 class="total"> <?php echo "Danh sách gồm " . ($index-1) . " cuốn sách (" . $damuon . " cuốn sách đã mượn)."; ?> </h4>
</tbody>
</table>
<br>
<div class="btn" style="display:flex; justify-content: space-between;">
<a href="tiepnhansachmoi.php"><button>Quay lại</button></a>
</div>
</div>
<?php
mysqli_close($conn);
?>
</div>
</div>
</div>
</body>
<footer>
<h4>
Một sản phẩm của nhóm sinh viên trường Đại học Công nghệ thông tin
<span>
©
</span>
</h4>
</footer>
</html>