- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
<?php
include( "dbopen.php" );
function ShowTree($ParentID, $lvl) {
global $link;
global $lvl;
$lvl++;
$sSQL="SELECT id,title,pid FROM catalogue WHERE pid=".$ParentID." ORDER BY title";
$result=mysql_query($sSQL, $link);
if (mysql_num_rows($result) > 0) {
echo("<UL>\n");
while ( $row = mysql_fetch_array($result) ) {
$ID1 = $row["id"];
echo("<LI>\n");
echo("<A HREF=\""."?ID=".$ID1."\">".$row["title"]."</A>"." \n");
ShowTree($ID1, $lvl);
$lvl--;
}
echo("</UL>\n");
}
}
ShowTree(0, 0);
mysql_close($link);
?>