I need help coding a feature I'm working on to be able to add, edit, browse limitless dirs, subdirs without having to add another column onto mySQL, instead by using a path like
/home/something/something/something
in one mySQL column to browse.
I've got the basic part done of the browsing, its capable of browsing but the only problem is that it displays an undefined offset.
Could you provide assistance in fixing it or providing a totally new approach without modifying the current progress.
$pdsnd2031 = $DB->query ("SELECT catpath FROM links_cat WHERE catid='$cid'");
list($catpath) = $DB->getrow ($pdsnd2031);
$xcounslash = explode("/", $catpath);
$pn = 1; // count the number of occurences
while ($xcounslash[$pn] !="") {
$pn++;
}
$result1 = $DB->query ("SELECT catid,cattitle,catdesc,catpath FROM links_cat WHERE (catpath LIKE '$catpath%')");
opentable();
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n"
." <tr>\n";
$d = 0;
while(list($catid,$cattitle,$catdesc,$xcatpath) = $DB->getrow ($result1)) {
$counslash = explode("/",$xcatpath);
$pn1 = 1; // count the number of occurences
while ($counslash[$pn1] !="") {
$pn1++;
}
//the next line is to limit the directory to one further subdir so it doesn't display a subdir of a subdir in the subdir.
IF ($pn1 - $pn == 1) {
IF ($d == 2) {
echo " </tr>\n"
." <tr>\n";
$d = $d - 2;
} ELSE {
echo " <td width='50%' valign='top'><font size='1' class='content'><center><b><a href='index.php?index=act&action=links&catid=$catid'>$cattitle</a></b></center>$catdesc</td>\n";
$d++;
}
} ELSE {
//print nothing
}
}