Recursive folder listing in a drop down menu, in php

Husam Hamoda

New Member
Im building a file manager which allows users to create folders within folders (within folders) to store their files. I didn't put a real limit on the depth of folders, but I'll probably make it 10 or something like that. How could I list all the folders (in a tree structure) inside the drop down menu, like so?\[code\]//Folder 1/Folder 2 /Child of folder 2 /Child of child of folder 2 /Another Child of of folder 2/Folder 3\[/code\](perhaps a little prettier).I use mysql to store the folder data\[code\]CREATE TABLE IF NOT EXISTS `folders` ( `f_id` int(11) NOT NULL AUTO_INCREMENT, `f_parent` int(11) NOT NULL, `f_owner` int(11) NOT NULL, `f_name` varchar(255) NOT NULL, `f_desc` varchar(1000) NOT NULL, `f_added` int(11) NOT NULL, `f_files` int(11) NOT NULL, `f_private` int(1) NOT NULL, `f_password` varchar(255) NOT NULL, PRIMARY KEY (`f_id`), UNIQUE KEY `f_parent` (`f_parent`,`f_owner`,`f_name`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\[/code\]
 
Back
Top