Hey, I've implemented a tree in a mysql table using:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
This is the method where you have a table like:
+-------------+----------------------+-----+-----+
| category_id | name | lft | rgt |
+-------------+----------------------+-----+-----+
| 1 | ELECTRONICS | 1 | 20 |
| 2 | TELEVISIONS | 2 | 9 |
| 3 | TUBE | 3 | 4 |
| 4 | LCD | 5 | 6 |
| 5 | PLASMA | 7 | 8 |
| 6 | PORTABLE ELECTRONICS | 10 | 19 |
| 7 | MP3 PLAYERS | 11 | 14 |
| 8 | FLASH | 12 | 13 |
| 9 | CD PLAYERS | 15 | 16 |
| 10 | 2 WAY RADIOS | 17 | 18 |
+-------------+----------------------+-----+-----+
To print the table out like normal, you would just orderby the lft column. Is there any easy way to order it in reverse, or have another column like "cost" where all entries of the same "depth" are ordered by cost?
Thanks