Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: catOrder bug?  (Read 2183 times)

centered

  • Guest
catOrder bug?
« on: December 09, 2007, 04:51:02 pm »

On a default install, entering over 10 categories, the engine does not sort the categories properly:

Test SQL:
Code: [Select]
INSERT INTO `categories` VALUES (1, 'catone', 'catone', '', 'YES', 0);
INSERT INTO `categories` VALUES (2, 'cattwo', 'cattwo', '', 'YES', 0);
INSERT INTO `categories` VALUES (3, 'catthree', 'catthree', '', 'YES', 0);
INSERT INTO `categories` VALUES (4, 'catfour', 'catfour', '', 'YES', 0);
INSERT INTO `categories` VALUES (5, 'catFive', 'catfive', '', 'YES', 0);
INSERT INTO `categories` VALUES (6, 'catsix', 'catsix', '', 'YES', 0);
INSERT INTO `categories` VALUES (7, 'catseven', 'catseven', '', 'YES', 0);
INSERT INTO `categories` VALUES (8, 'cateight', 'cateight', '', 'YES', 0);
INSERT INTO `categories` VALUES (9, 'catnine', 'catnine', '', 'YES', 0);
INSERT INTO `categories` VALUES (10, 'cat--ten', 'catten', '', 'YES', 0);
INSERT INTO `categories` VALUES (11, 'cat--eleven', 'cateleven', '', 'YES', 0);

Cat-ten should not be second!!
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: catOrder bug?
« Reply #1 on: December 09, 2007, 05:18:35 pm »

@equilni : Without catorder values assigned (only 0 shown) order of records retrieved from MySql according to clause 'ORDER BY catorder ASC' is ... for all practical purposes ... undefined, You know.
Logged

centered

  • Guest
Re: catOrder bug?
« Reply #2 on: December 09, 2007, 05:22:28 pm »

Thanks codetwist.  Then it should be sorted by catorder, then id, if catorder is not "for all practical purposes," ... defined

Code: [Select]
$query = "SELECT * FROM ".db('prefix')."categories WHERE published = 'YES' ORDER BY catorder,id ASC";
Logged