summaryrefslogtreecommitdiff
path: root/includes/functions_category.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-04-24 19:40:50 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-04-24 19:40:50 -0600
commit2098bf444afadcf0363d89b4cc1dca5d2213d754 (patch)
treeda93b29e22170d7be7c9ed215fde5238e9d76178 /includes/functions_category.php
parentaae25cd709d486f7ee9513753d40eb5cc239c42d (diff)
Remove all uses of db_inc.php
This method of importing the database login every time wasn't very good. Now everything uses the new Database singleton class.
Diffstat (limited to 'includes/functions_category.php')
-rw-r--r--includes/functions_category.php17
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