i got same problem and i have found óne solution, but works MsSql only
http://www.sqlteam.com/item.asp?ItemID=1353
with queries this should be done like this,but problem is odbc_connection that should be closed if next fetch_row begins ... and then how to get back to bottom of tree ??
let me know if you get this work.
$count = 0;
$q[$count]select * from table where parent = 0
while {
include("page2.php");
//page 2//
$count ++;
$q[$count] =select * from table where parent = odbc_result($q[$count-1,"id"])
while(odbc_num_rows($q[$count]) == -1)
{
include(page2.php);
}
if($q[$count] != -1)
{
$count--;
}
}