-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
86 lines (42 loc) · 1.72 KB
/
single.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
79
80
81
82
83
84
85
86
<?php
$url= 'http://localhost/test/';
// if ( ! $_GET('id')) {
// header('location: index.php');
// }
$id= $_GET['id'];
$con = mysqli_connect('localhost', 'root', '', 'class_blog');
$sql = "SELECT
posts.*, categories.title as categoryTitle
FROM posts
JOIN categories ON posts.category_id = categories.id
WHERE posts.id = '$id' ";
$result = mysqli_query($con, $sql);
$data = mysqli_fetch_assoc($result);
include('include/header.php');
?>
<div class="main-content">
<div class="container">
<div class="row clearfx">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="single-post">
<h1> <?php echo $data['title']; ?></h1>
<div class="" style="margin: 10px, 0px; ">
<h2>Category: <?php echo $data['categoryTitle']; ?></h2>
</div>
<div class="row">
<div class="col-md-12">
<img src="admin/<?php echo $data['image']; ?>" alt="">
</div>
<div class="col-md-12">
<?php echo substr( $data ['description'], 0, 8000 ); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include('include/footer.php');
?>