Hey everyone. I'm looking for assistance/suggestions/answers on how to build a select dropdown box from data that needs to be pulled recursively from a MySQL database. Basically the situation is mainly for a dicussion thread system type of thing where I have categories nested inside categories, nested inside categories... Anyway, I want to be able to build a drop down box containing all the categories indented underneath it's parent category to look something similar to this:
------------------------- Top Level Category - Nested Category - Lower level - Etc.... Top Level Category - Nested Category Top Level Category ------------------------- Then the user will be able to select one from the dropdown menu. I have all the categories stored in a MySQL database called site_categories. The table is setup like this: __________________________________ | Cat_ID | Cat_Parent | Cat_Name | |---------------------------------------------| | 1 | 0 | Top Level 1 | |---------------------------------------------| | 2 | 1 | Nested 1 | |---------------------------------------------| | 3 | 0 | Top Level 2 | |---------------------------------------------| | 4 | 2 | Nested 2 | |---------------------------------------------| Sorry for the bad pictures you hopefully you get the idea. Anything with a 0 Cat_Parent is a Top Level category. Then the others are all nested inside other categories that have the same Cat_ID as the nested categories Cat_Parent. I basically need help creating a properly indented dropdown menu box using this structure from the database. I assume I'm gonna have to use some sort of recursion here, but I'm not sure how to go about this. Please help if you can. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php