Hi Tabish,
the basic idea is simple:
create a function that gets the "parent-member", that means the place where you currently are in your tree, as an attribute. The function has two purposes:
1.) print the name of the parent-member
2.) check if there is/are child-members of this parent-member and if there are some, call the function again with the child-member as attribute (parent-member for the function called)
Example:
function ListMember() {
$query = mysql_query ("select * from members where parent-member = '0');
$result = mysql_query($query);
while ($result_row = mysql_fetch_array($result)) {
// purpose 1:
echo $result_row[member_name];
// purpose 2:
$query2 = "select * from members where parent-member = '".$result_row[member_id]."'";
$query2 = mysql_query($query2);
if (mysql_num_rows($query2) > 0) {
ListMember($result_row[member_id);
}
}
}
maybe i have an error in the code...
however the solution above is just to give you an idea, there are much too many db_queries in this example, it would be better to read them into an array and sort them there, however, this is a different story.
Matthias