diff options
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 |