Search Posts

Category: tree

Recursive SQL query on nested-set tree with stop condition

how to – Recursive SQL query on nested-set tree with stop condition I am using a nested-set tree structure in a table. The concept is described here. The example data looks as follow: +—-+———–+——+——-+—————–+ | id | parent_id | left | right | stop_descending | +—-+———–+——+——-+—————–+ | 1 | NULL | 1 | 10 | 0 | | 2 | 1 | 2 | 3 | 0 | | 3 | 1 | 4 | […]

Invalid PHP tree data grouping

I’m writing a forum software as a practice. Sadly I ran into a small problem. The data does not display as it was intended. Thread’s are not being grouped to their respective categories. Instead a Category table is being echoed for each Thread instead of groping them as once again intended. For example. As illustrated in the image below. Front Page News and Feedback should both be in General, instead they are echoed as separate […]

How to render two way tree structure values into HTML table

I am trying to create a HTML tabular tree structure. The MYSQL table structure is mentioned below.But output is not coming in proper way. All Tree Structure displayed in distorted way. I want Balanced Structure. If there is no value it will traverse until maximum depth level with dummy nodes. +——————————————————-+ | id agent_code sponsor_code pair_id leg depth_level | +——————————————————-+ | 1 1272129311 0 0 Left 0 | | 13 1377239554 1349404179 1 Right 2 […]