diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-05-08 17:30:08 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-08 17:30:08 -0600 |
commit | 87b1dfd1f77b08915ee5e905da45e316ba2c0e7d (patch) | |
tree | f6c0f8d09454b6e887df0f66ca37c1ce9efb30d0 /includes/functions_category.php | |
parent | 0b045d57b2164b5ce003955d79627ae506a153eb (diff) | |
parent | a09d9f377f5c055e42e5f21b5cdea64c2e2ca896 (diff) |
Merge pull request #14 from cflip/refactor
Huge refactor
Diffstat (limited to 'includes/functions_category.php')
-rw-r--r-- | includes/functions_category.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/includes/functions_category.php b/includes/functions_category.php new file mode 100644 index 0000000..808708c --- /dev/null +++ b/includes/functions_category.php @@ -0,0 +1,17 @@ +<?php + +function get_all_categories(): array +{ + $sql = "SELECT cat_id FROM categories ORDER BY cat_id;"; + $result = Database::get()->query($sql); + + $categories = array(); + + foreach ($result as $row) { + $category = new Category(); + $category->get_from_database($row['cat_id']); + array_push($categories, $category); + } + + return $categories; +}
\ No newline at end of file |