This article deals with the display of tree-structures that are driven by a database. There are actually a few approaches to transform a 2-dimensional structure into a tree, and it seems odd that most are unknown to many developers.
The most obvious approach is using the parent-ID as a back-reference for recursion. But then what happens if the tree-structure gets a bit bigger? How about 5 childnodes and a depth of 5 levels? Well, suddenly you end up with 52 database requests and your application becomes incredibly slow... That's why we're just about to bin the idea of using the parent-ID!
By Pascal Opitz