-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathblog_read.php
More file actions
69 lines (51 loc) · 2.06 KB
/
blog_read.php
File metadata and controls
69 lines (51 loc) · 2.06 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
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "db";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blog</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<style>
body {
background-image: url('images/img.jpeg');
background-size:cover;
background-repeat: no-repeat;
filter: opacity(93%);
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<div class="container-fluid m-3">
<a href="blog.php#blogs"><button type="button" class="btn btn-warning">Return</button></a>
<div class="container bg-light m-5 p-5">
<?php
$sql = "SELECT * FROM blog";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)){
echo ' <div class="container" id= "' . $row['id'] . '">
<img src="images/' . $row['img'] . ' " style="width: 40vw">
<h2 class="h2 my-5 pt-5 pb-2">' . $row['title'] . '</h2>
<div class="container">
<p>' . $row['content'] . '</p><br><br><br><br><br><br>
</div>
</div>
';
}
?>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>