I have been asked to create a hierarchical file structure to manage file uploads so that a company can share documents. It will be possible for them to create new folders inside folders and also create new master folders (although this is not a physical file structure - no folders actually exist or are created, just the idea of a folder). The uploads are inserted into the database and stored as binary in a mediumblob. There are two tables that deal with this facility, one for the files and one for the folders, this is the structure of the folders table:
#
# Table structure for table `cabinet_folders`
#
CREATE TABLE `cabinet_folders` (
`cf_id` int(11) NOT NULL auto_increment,
`cf_label` varchar(255) NOT NULL default '',
`cf_parent_id` int(11) NOT NULL default '0',
`cf_sect_id` int(11) NOT NULL default '0',
PRIMARY KEY (`cf_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
The cabinet_folders table holds details about each folder and references its parent folder via its cf_id. I need to move recursively through this so that the file structure is graphically displayed using some folder icons i have made. At the moment this would be simple as i know what folders there are but as this needs to be dynamic i need to be able to do this dynamically, any ideas?
Thanks.