I want to make a site where there will be unlimited number of categories.
For categories create a table cat, which stores all categories and their sub categories.
The cat table contains three columns: id, name, prev_id (parent). Basic (root) categories have a parent (prev_id) = 0.
The rest of the categories have corresponding id of the parent.
Get all categories from cat to a variable, and both of them continue to build a tree, I do not understand.
Anyway, I already found the article on this topic. phpdes.com/постоение-дерева
but I still don't get it.Can anyone help to explain, verbally, to describe the algorithm of building the tree?
Do not have an example on the link you another way.
Or at least zakommentirovat code link.