Cheeky Chino Posted January 30, 2007 Share Posted January 30, 2007 Hi Guys,I have a script to create virtual folders to organise some files, you can create head folder, and branch down sub folders as much as you want.My database is like:FolderID - Name - SubFolder1 - Folder 1 - 02 - Folder 2 - 13 - Folder 3 - 14 - Folder 4 - 35 - Folder 5 - 0What i want is to have that dynamically pulled out and displayed as suchFolder 1-- Folder 2-- Folder 3----Folder 4Folder 5What i've tried so far that came close to working is the following code, but it's all not in order :(.[CODE]// Create list of available folders to put this new one in$sql = mysql_query("SELECT * FROM sg_folders ORDER BY FolderID, SubFolder");while ($row = mysql_fetch_array($sql)) { $folderid = $row['FolderID']; $foldername = $row['Name']; $subfolder = $row['SubFolder']; $indent = 0; while($subfolder) { $indent ++; $sql2 = mysql_query("SELECT * FROM sg_folders WHERE FolderID = ".$subfolder); if (mysql_num_rows($sql)) { while ($row2 = mysql_fetch_array($sql2)) $subfolder = $row2['SubFolder']; } else $subfolder = ''; } $i = 0; $pretext = ''; while ($i <= $indent) { $i ++; $pretext .= "--"; } $folders .= "<option value='".$folderid."'>".$pretext." ".$foldername."</option>"; }[/CODE]Could anyone help or let me know how to approach it, i've tried a few things and simply cant figure it out.Chino Link to comment https://forums.phpfreaks.com/topic/36280-php-dyanamic-virtual-folder-listing-help/ Share on other sites More sharing options...
TEENFRONT Posted January 30, 2007 Share Posted January 30, 2007 dude... change your freaking signature font size!! Link to comment https://forums.phpfreaks.com/topic/36280-php-dyanamic-virtual-folder-listing-help/#findComment-172488 Share on other sites More sharing options...
Cheeky Chino Posted January 30, 2007 Author Share Posted January 30, 2007 Yeah done that already but post didnt update. Link to comment https://forums.phpfreaks.com/topic/36280-php-dyanamic-virtual-folder-listing-help/#findComment-172491 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.