From 5d703ab4ea6e8ead889232ba846596b948bdb051 Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:17:53 -0600 Subject: Update names of database variables --- includes/model/Category.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'includes/model/Category.php') diff --git a/includes/model/Category.php b/includes/model/Category.php index fb57918..8aa489c 100755 --- a/includes/model/Category.php +++ b/includes/model/Category.php @@ -17,7 +17,7 @@ class Category public function __construct($id) { - $sql = "SELECT cat_name, cat_description, cat_thread_count, cat_post_count FROM categories WHERE cat_id = ?;"; + $sql = "SELECT category_name, category_description, category_thread_count, category_post_count FROM categories WHERE category_id = ?;"; $result = Database::get()->query($sql, "i", $id); if (empty($result)) { @@ -25,10 +25,10 @@ class Category } $this->id = $id; - $this->name = $result[0]['cat_name']; - $this->description = $result[0]['cat_description']; - $this->thread_count = $result[0]['cat_thread_count']; - $this->post_count = $result[0]['cat_post_count']; + $this->name = $result[0]['category_name']; + $this->description = $result[0]['category_description']; + $this->thread_count = $result[0]['category_thread_count']; + $this->post_count = $result[0]['category_post_count']; $this->has_value = true; } @@ -41,13 +41,13 @@ class Category public static function get_all_categories(): array { - $sql = "SELECT cat_id FROM categories ORDER BY cat_id;"; + $sql = "SELECT category_id FROM categories ORDER BY category_id;"; $result = Database::get()->query($sql); $categories = array(); foreach ($result as $row) { - $category = new Category($row['cat_id']); + $category = new Category($row['category_id']); array_push($categories, $category); } @@ -56,7 +56,7 @@ class Category public function get_threads(): array { - $sql = "SELECT thread_id FROM threads WHERE thread_category = ? ORDER BY thread_date_lastpost DESC"; + $sql = "SELECT thread_id FROM threads WHERE thread_category = ? ORDER BY thread_last_post_date DESC"; $result = Database::get()->query($sql, "i", $this->id); $threads = array(); @@ -71,7 +71,7 @@ class Category public function get_latest_thread(): Thread { - $sql = "SELECT thread_id FROM threads WHERE thread_category = ? ORDER BY thread_date_lastpost DESC LIMIT 1"; + $sql = "SELECT thread_id FROM threads WHERE thread_category = ? ORDER BY thread_last_post_date DESC LIMIT 1"; $result = Database::get()->query($sql, "i", $this->id); return new Thread($result[0]['thread_id']); } -- cgit v1.2.3