Jump to content

[SOLVED] tree structures


RichardRotterdam

Recommended Posts

I've encountered this situation a couple of times and usually i solved it by using some php.

So here is the situation.

 

When having to deal with tree structures sometimes it would be nice to have some sort of inheritance and getting all the child items.

 

for example when you have the following tree structure using 2 tables

categories and products

 

category1

-product1

-product2

+category2

-product3

-product4

+category3

-product5

-product6

 

let's say i want all the products in category1 including all the products in the sub categories.(in this case products 1 to 6)

 

what would be the best way to solve this. I am thinking about using a stored procedure for this and using some kind of loop in it. Would this be the best approach ?

I just want methods of solving it I dont want any full working queries or code i just want some hints.

 

ty

 

 

Link to comment
https://forums.phpfreaks.com/topic/127368-solved-tree-structures/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.