-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_categories.php
27 lines (26 loc) · 1.01 KB
/
admin_categories.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
<?php
require("connect.php");
require("templates/header.php");
/* SELECT ALL DATA FROM sneaker_categorys table*/
$query = "SELECT * FROM sneaker_category";
$statement = $db->prepare($query); // Returns a PDOStatement object.
$statement->execute(); // The query is now executed.
$categories = $statement->fetchAll();
?>
<div class="container" id="all_categories">
<?php if(isset($_SESSION['logged_in_user']) && $_SESSION['admin_is_on'] === 1): ?>
<h1>Categories</h1>
<h2><a href="create_category.php">Create category</a></h2>
<div class="card-columns">
<?php foreach($categories as $category): ?>
<div class="card">
<div class="card-body">
<h5 class="card-title"><?=$category['category_name']?></h5>
<a href="edit_category.php?id=<?=$category['category_id']?>" class="btn btn-primary">Edit Or Delete</a>
</div>
</div>
<?php endforeach ?>
</div>
<?php endif ?>
</div>
</html>