-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog1.php
78 lines (65 loc) · 2.2 KB
/
blog1.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
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="blog1.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css"
integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<title>Blogs <?php echo $_GET['sno']?></title>
</head>
<body>
<?php
require_once('header.php');
?>
<div class="comppage">
<b class="back">
<a style = "color:white" href = "./blogs.php">
<p class="back-btn"> ⬅ Back To Blog List </p>
</a>
</b>
<br><br>
<br><br>
<?php
//making connection with the database
$servername = "localhost";
$username = "root";
$password = "";
$database = "blogs";
$conn = mysqli_connect($servername, $username, $password, $database);
if ($conn) {
// reading entries from blogs database
$sql = "SELECT * FROM `blogs`";
$result = mysqli_query($conn, $sql);
//Initializing the count
$i = 0;
//counting total blogs
if ($result) {
while(($row = mysqli_fetch_assoc($result))['s.no.'] != $_GET['sno']) {}
echo '
<div class="blogtitle">
<br>
<div class="heading">
<b>'.$row['blog_topic'].'</b>
</div
<br>
<div class="subheading">'.$row['topic_of_interest'].' </div>
<br><br>
</div>
<br>
<div class="contentcontainer"><br> '.$row['content'].'</div>
<br><br>
';
}
}
else {
die("connection with blogs database was unsuccessful : ".mysqli_connect_error());
}
echo'</div>';
?>
<br><br>
<?php
require_once('footer.php');
?>
</body>
</html>