public function getCategoriesList() { $db = $this->db; $categories = array(); if (!($stmt = $db->query("SELECT `id` FROM {$this->TABLE_NAME_CATEGORY} ORDER BY -id DESC"))) { echo '<h2>Ошибка поддключения к базе данных!</h2>'; die; } else { while ($row = $stmt->fetch_assoc()) { $item = new ItemCategory(); $item->queryCategory($db, $row['id']); array_push($categories, $category); } } return $categories; }
public function getCategoryByID($id) { $db = $this->db; $category = new ItemCategory(); $category->queryCategory($db, $id); return $category; }