forked from panakuma/book-lib-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrefine.php
68 lines (68 loc) · 2.22 KB
/
refine.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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>絞り込み</title>
<link rel=stylesheet href="main.css" type="text/css" charset="utf-8" />
<script src="jq/jquery-3.2.1.js" type="text/javascript"></script>
<script src="jq/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#booksTable").tablesorter();
}
);
</script>
</head>
<body>
<?php
require_once '../conf/DbManager.php';
try{
$column = $_GET['column'];
$char = $_GET['text'];
$sql = "SELECT * FROM books WHERE $column LIKE '%$char%'";
$stmh = $db->prepare($sql);
$stmh->execute();
}catch(Exception $Exception){
echo '検索エラー:' .$Exception->getMessage();
die();
}
?>
<h1>絞り込み <?php echo h($_GET['column']).": ".h($_GET['text']); ?></h1>
<table class="books">
<thead>
<tr>
<th>タイトル</th>
<th>著者</th>
<th>出版</th>
<th>ジャンル</th>
<th>貸出状況</th>
<th>所在・借用者</th>
</tr>
</thead>
<tbody>
<?php
$data_num = 0;
while($row = $stmh->fetch(PDO::FETCH_ASSOC)){
$data_num++;
?>
<tr>
<td><a href="edit.php?isbn=<?=h($row['ISBN'])?>"><?=h($row['title'])?></a></th>
<td><a href="refine.php?column=author&text=<?=h($row['author'])?>"><?=h($row['author'])?></a></th>
<td><a href="refine.php?column=publisher&text=<?=h(['publisher'])?>"><?=h($row['publisher'])?></a></th>
<td><a href="refine.php?column=genre&text=<?=h($row['genre'])?>"><?=h($row['genre'])?></a></th>
<td><a href="refine.php?column=loan&text=<?=h($row['status'])?>"><?=h($row['status'])?></a></th>
<td><a href="refine.php?column=borrower&text=<?=h($row['borrower'])?>"><?=h($row['borrower'])?></a></th>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
echo "データ件数: ".h($data_num);
$db = null;
?>
<br>
<a href="./">一覧に戻る</a>
</body>
</html>