I am trying to create a list of books by category by category, where each book can belong to more than one category, and each category can be either a parent or a subcategory.
Here is an illustration:
Javascript
JavaScript Templates
Object oriented javascript
Php
PHP in a Nutshell PHP jQuery Cookbook
Ajax
The Complete Ajax Guide
Bulletproof Ajax
- XML
XML hacks
No XML Reliability
-
As you can see...
- The book "PHP jQuery Cookbook" falls into two categories: PHP and jQuery
- The Ajax category is a child of JavaScript and a parent of XML (but XML is not a child of JavaScript).
I designed the database tables as follows:
BOOK: book_id, book_title CATEGORY: category_id, category_name BOOK_CATEGORY: book_id, category_id CATEGORY_TREE: parent_category_id, child_category_id
I read many other questions / answers on hierarchical data in MySQL, but nothing that can handle this type of βfreeβ hierarchy.
Does anyone know how to set up a list this way?
source share