Last change
on this file was 0791611, checked in by sstalevska <sara.stalevska@…>, 2 years ago |
Push the entire project.
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | <?php
|
---|
2 | require_once('./inc/common.php');
|
---|
3 |
|
---|
4 | $pageTitle = 'Categories';
|
---|
5 | $pageSlug = 'categories';
|
---|
6 |
|
---|
7 | require_once('./inc/head.php');
|
---|
8 | require_once('./inc/header.php');
|
---|
9 | ?>
|
---|
10 | <div class="container">
|
---|
11 | <h1 class="mt-5"><?= $pageTitle ?></h1>
|
---|
12 |
|
---|
13 | <?php require_once('./inc/alerts-err.php'); ?>
|
---|
14 |
|
---|
15 | <p class="lead mb-4">This is a list of all categories. Select a category to view businesses listed under it.</p>
|
---|
16 |
|
---|
17 | <table class="table">
|
---|
18 | <thead>
|
---|
19 | <tr>
|
---|
20 | <th width="1"><abbr title="Number">#</abbr></th>
|
---|
21 | <th>Category Name</th>
|
---|
22 | <th width="1">Action</th>
|
---|
23 | </tr>
|
---|
24 | </thead>
|
---|
25 | <tbody>
|
---|
26 | <?php
|
---|
27 | /**
|
---|
28 | * Fetch all categories and display them in a table.
|
---|
29 | */
|
---|
30 | $i = 0;
|
---|
31 | $sql = 'SELECT category_id, category_name FROM category ORDER BY category_name';
|
---|
32 | foreach ($conn->query($sql) as $row) {
|
---|
33 | $i++;
|
---|
34 | ?>
|
---|
35 | <tr>
|
---|
36 | <td class="text-end"><?= $i ?>.</td>
|
---|
37 | <td><a href="/category.php?id=<?= $row['category_id'] ?>"><?= $row['category_name'] ?></a></td>
|
---|
38 | <td><a class="btn btn-sm btn-dark" href="/category.php?id=<?= $row['category_id'] ?>">View</a></td>
|
---|
39 | </tr>
|
---|
40 | <?php } ?>
|
---|
41 | </tbody>
|
---|
42 | </table>
|
---|
43 | </div>
|
---|
44 | <?php
|
---|
45 | require_once('./inc/footer.php');
|
---|
Note:
See
TracBrowser
for help on using the repository browser.