Ich präsentiere hier mal meine Lösung:

Das PHP Script "sub.php":
PHP-Code:
<?php
$host 
"localhost";
$user "root";
$password "deinpasswort";
$db "sub";
global 
$maxstufe;
$maxstufe 10;
$connection mysql_connect($host$user$password);
mysql_select_db($db);
sub_loop(""0"");

function 
sub_loop($id$stufe$zeiger) {
  global 
$maxstufe;
  
$temp get_subs($id);
  for(
$j 0$j count($temp); $j++) {
      echo 
$zeiger.">".$temp[$j]['name'] ."<br>\n";
      if(
$stufe $maxstufe) {
        
sub_loop($temp[$j]['id'], ($stufe+1), $zeiger."&nbsp;&nbsp;");
      }
  }
}

function 
get_subs($id) {
  
$query "SELECT * FROM `sub` WHERE `parent` = '".$id."';";
  
$response mysql_query($query);
  while(
$temprow mysql_fetch_array($response)) {
    
$returnarray[] = $temprow;
  }
  return 
$returnarray;
}
mysql_close($connection);
?>
Die MySQL Befehle:
PHP-Code:
#
# Tabellenstruktur für Tabelle `sub`
#

CREATE TABLE `sub` (
  `
idint(10NOT NULL auto_increment,
  `
parentint(10NOT NULL default '0',
  `
namevarchar(200NOT NULL default '',
  
PRIMARY KEY  (`id`)
TYPE=MyISAM AUTO_INCREMENT=11 ;

#
# Daten für Tabelle `sub`
#

INSERT INTO `subVALUES (10'1');
INSERT INTO `subVALUES (20'2');
INSERT INTO `subVALUES (31'1.1');
INSERT INTO `subVALUES (41'1.2');
INSERT INTO `subVALUES (52'2.1');
INSERT INTO `subVALUES (62'2.2');
INSERT INTO `subVALUES (73'1.1.1');
INSERT INTO `subVALUES (83'1.1.2');
INSERT INTO `subVALUES (94'1.2.1');
INSERT INTO `subVALUES (104'1.2.2'); 
Und das Ergebnis:
http://mannithedark.ma.funpic.de/Tests/sub.php

Manni