-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
56 lines (52 loc) · 1.91 KB
/
index.php
File metadata and controls
56 lines (52 loc) · 1.91 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
<?php
require_once __DIR__ . '/login_check.php';
require_once __DIR__ . '/inc/functions.php';
include __DIR__ . '/inc/header.php';
?>
<?php
try {
$dbh = db_open();
$sql = 'SELECT * FROM books';
$statement = $dbh->query($sql);
?>
<div class="container">
<h4>登録している本</h4>
<table class="table table-hover table-sm caption-top">
<caption>List of books</caption>
<thead>
<tr>
<th scope="col">タイトル</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php while ($row = $statement->fetch()) : ?>
<tr>
<td><?php echo str2html($row['title'] . "(" . $row['authors'] . ")") ?></td>
<td>
<div class="d-flex flex-row">
<div class="px-1">
<form action="">
<input type="submit" value="蔵書検索">
</form>
</div>
<div class="px-1">
<form action="./delete_book.php" method="post">
<input type="hidden" name="id" value="<?php echo (int)$row['id']; ?>">
<input type="submit" value="削除">
</form>
</div>
</div>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
<?php
} catch (PDOException $e) {
echo "エラー!:" . str2html($e->getMessage());
exit;
}
?>
<?php include __DIR__ . '/inc/footer.php';