-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread.php
More file actions
40 lines (33 loc) · 1.12 KB
/
read.php
File metadata and controls
40 lines (33 loc) · 1.12 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
<?php
include "conexao.php";
if(isset($_GET['id'])){
$id = $_GET['id'];
$sql = "SELECT * FROM livros WHERE id = $id";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="container">
<?php if($row): ?>
<h2>Detalhes do Livro</h2>
<p><strong>ID:</strong> <?php echo $row['id']; ?></p>
<p><strong>Título:</strong> <?php echo $row['titulo']; ?></p>
<p><strong>Autor:</strong> <?php echo $row['autor']; ?></p>
<p><strong>Ano de publicação:</strong> <?php echo $row['ano']; ?></p>
<p><strong>Gênero:</strong> <?php echo $row['genero']; ?></p>
<p><strong>Editora:</strong> <?php echo $row['editora']; ?></p>
<a class="btn btn-secondary" href="index.php">Voltar</a>
<?php else: ?>
<p>Livro não encontrado.</p>
<?php endif; ?>
</div>
</body>
</html>