-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathcategory.php
51 lines (37 loc) · 1.49 KB
/
category.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
<?php include "includes/db.php"; ?>
<?php include "includes/header.php"; ?>
<?php include "includes/scrollTopButton.php"; ?>
<body>
<!-- Navigation -->
<?php include "includes/navigation.php"; ?>
<!-- Page Content -->
<div class="container">
<div class="row">
<!-- Blog Entries Column -->
<div class="col-md-8">
<?php
if (isset($_GET['category'])) {
$link_category = $_GET['category'];
}
$query = "SELECT * FROM categories WHERE cat_id={$link_category}";
$select_categories_id = mysqli_query($connection, $query);
$cat = mysqli_fetch_assoc($select_categories_id);
?>
<h1 class="text-center" style="color:white;"><?php echo $cat['cat_title']; ?>-Blog Posts</h1>
<?php
$query = "SELECT * FROM posts WHERE post_category_id=$link_category";
$select_all_posts_query = mysqli_query($connection, $query);
$render = include_once __DIR__ . "/includes/post-view.php";
while ($row = mysqli_fetch_assoc($select_all_posts_query)) {
$render($row, $cat);
}
?>
</div>
<!-- Blog Sidebar Widgets Column -->
<?php include "includes/sidebar.php"; ?>
</div>
<!-- /.row -->
<hr>
<?php
include "includes/footer.php";
?>