I am trying to create a sub tree menu and make sure every single directory is being viewed and mapped out. As you can see I would like the $subbing to repeat the whole process again but as long it is maintaining within its dir path that was previously echoed out
$new_array = array("../uploads/rafcastro77/jeff/jeff/portfolio/",
"../uploads/rafcastro77/one/",
"../uploads/rafcastro77/three/",
"../uploads/rafcastro77/two/jeff/jeff/portfolio/");
foreach($new_array as $branch_sub){
$array = $branch_sub;
$array = explode('/', $array);
$subs = '';
$subbing = '';
foreach($array as $arrays){
//collect sql
$sql = mysql_query("SELECT * FROM data WHERE dir='$subbing'");
$subbing .= $arrays . '/';
while($row = mysql_fetch_array($sql)){
$path = $row["path"];
$file_name = $row["sub_dir"];
if(empty($file_name)){
echo "<li>" . $path . "</li>";
}else{
echo "<li>" . $file_name .
" - repeat this sub $subing with another loop until end</li>";
}}
//end collect sql
if(!empty($arrays)){echo '<li><span>' . $arrays . '</span><ul>';}}
foreach($array as $arrays){
if(!empty($arrays)){echo '</ul></li>';}
}}
This is the result I get once a assembled with its css sheet on the picture as you can see I did a little diagram to get an idea of what I need I hope that helps.
I would want it to keep repeating till the is no more directory-subs within folder.