-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.php
44 lines (40 loc) · 1.47 KB
/
view.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Blog</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body>
<header class="p-4 bg-dark text-center">
<h1><a href="index.php" class="text-light text-decoration-none">Simple Blog</a></h1>
</header>
<div class="post-list">
<div class="container">
<?php
$id = $_GET["id"];
if ($id) {
include("connect.php");
$sqlSelect = "SELECT * FROM posts WHERE id = $id";
$result = mysqli_query($conn, $sqlSelect);
while ($data = mysqli_fetch_array($result)) {
?>
<div class="post bg-light p-4 mt-5">
<h1><?php echo $data["title"]; ?></h1>
<p><?php echo $data["date"]; ?></p>
<p><?php echo $data["content"]; ?></p>
</div>
<?php
}
} else {
echo "No post found";
}
?>
</div>
</div>
<div class="footer bg-dark p-4 mt-4">
<a href="admin/index.php" class="text-light">Admin Panel</a>
</div>
</body>
</html>