2

I am working to build a category hierarchical like this:

Home

- Car
  - Yellow
  - Red
- Animal
  - Cat
     - Node1
     - Node2
  - Dog

I use php & mysql schema with nested set model:

- left
- right
- id

I want to get a tree from a Animal node to result and JSON structure this:

- Animal
  - Cat
     - Node1
     - Node2
  - Dog

I dont have any solution for that. Please help me !

1
  • If you're using nested set, then you need to do select with condition ` where left >= Animal's left and right <= Animal's right`. Commented Sep 7, 2017 at 9:33

1 Answer 1

1

This post is old , but maybe it helps other. Good article written in german including sql queries. http://www.klempert.de/nested_sets/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.