Hello,
I am creating a recursive menu tree and am really close.
Here is the code:
TABLE: // cat_level3 : id3_cat, cat_name, level2_cat, graphic, html_graphic, active
FUNCTION:
function recur_menu($st=0)
{
$sql = "select id3_cat, cat_name, level2_cat from cat_level3
where active <> 0 and level2_cat = $st order by cat_name";
$res = $this->dbh->query($sql);
while ($res->fetchInto($row))
{
$html .= $row['cat_name']."|".$row['id3_cat']."<BR>\n";
$html .= $this->recur_menu($row['id3_cat']);
}
$html .= "<BR>";
return $html;
}
RESULTS:
New One|1
Sub 1 of One|3
Sub 2 of One|4
Sub 3 of One|5
Sub 1 of One-2|8
New Three|6
New Two|2
Sub 1 of Two|7
WHAT I WANT:
--New One|1
----Sub 1 of One|3
----Sub 1 of One-2|8
------Sub 2 of One|4
--------Sub 3 of One|5
--New Three|6
--New Two|2
----Sub 1 of Two|7
I know I am very close, but just missing something.
Any suggestions?
Thanks.