Advertisement
Guest User

Category

a guest
Jan 15th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2.  
  3. class Category{
  4. /*
  5. * Returns an array of categories
  6. */
  7. public static function getCategoriesList(){
  8. $db = Db::getConnection();
  9. $categoryList = array();
  10.  
  11. $result = $db->query('SELECT id, name FROM category ORDER BY sort_order ASC');
  12. $i = 0;
  13. while($row = $result->fetch()){
  14. $categoryList[$i]['id'] = $row['id'];
  15. $categoryList[$i]['name'] = $row['name'];
  16. $i++;
  17. }
  18.  
  19. return $categoryList;
  20. }
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement