Building a tree view

leivdu1m

New Member
I'm a little stumped on this problem and I've been thinking about it for a while now. I have a table in my DB that holds a tasks. Each task can have a parent task by holding it's primary key in the parent_id field. I have no limit on how deep these tasks can be linked.\[code\]+-----------+-------+-----+| Field | Type | Key |+-----------+-------+-----+| id | int | PRI || parent_id | int | MUL |+-------------------+-----+\[/code\]A task without a parent_id is a "project" and all tasks can be grouped in task groups by sharing a parent task. I would now like to populate a HTML select box with all the descendant of the project.\[code\]Task 1 -Task 1.1 -Task 1.2 -Task 1.2.1 -Task 1.2.2 -Task 1.3Task 2\[/code\]How can I go about this? I figure some sort of recursive function is in order but I can't seem to really figure how to go about it.Any help would be greatly apprecaited. :)
 
Back
Top