nicky
10-04-2011, 07:53 PM
Not sure if this is more of a PHP or MySQL issue, but I'm leaning towards MySQL. I am trying to formulate the best and most efficient way to do this...
I have a user login system where users can upload files and assign those files to specific folders. Administrators can create folders and sub-folders. Let's say though the administrator decides to create a sub-folder five folders deep. I'd like the list the folders out in an unordered list, and the sub-folders would obviously be an indented to the parent list item.
My database table is set-up as so...
+---------+------------+-----------------+
| folder_id | folder_name | parent_folder_id |
+---------+------------+-----------------+
| 1 _____ | Animals ____| 0 _____________|
| 2 _____ | Cats ______ | 1 ____________ |
| 3 _____ | Tigers _____ | 2 ____________ |
| 4 _____ | Lions ______ | 2 ____________ |
+--------+--------------+----------------+
I need the unordered list to display:
- Animals
- Cats
- Tigers
- Lions
I cannot formulate the code so that additional indented unordered lists will appear if the admin were to add subfolders under the Tigers folder.
Does anyone have any ideas? I would really appreciate any and all help.
I have a user login system where users can upload files and assign those files to specific folders. Administrators can create folders and sub-folders. Let's say though the administrator decides to create a sub-folder five folders deep. I'd like the list the folders out in an unordered list, and the sub-folders would obviously be an indented to the parent list item.
My database table is set-up as so...
+---------+------------+-----------------+
| folder_id | folder_name | parent_folder_id |
+---------+------------+-----------------+
| 1 _____ | Animals ____| 0 _____________|
| 2 _____ | Cats ______ | 1 ____________ |
| 3 _____ | Tigers _____ | 2 ____________ |
| 4 _____ | Lions ______ | 2 ____________ |
+--------+--------------+----------------+
I need the unordered list to display:
- Animals
- Cats
- Tigers
- Lions
I cannot formulate the code so that additional indented unordered lists will appear if the admin were to add subfolders under the Tigers folder.
Does anyone have any ideas? I would really appreciate any and all help.