Here is what I want to do:
Lets say I have this table (or returned recordset)
A | A | B | C | C
1 | 2 | 1 | 3 | 5
i | ii | ii | i | iv
This is translated into to a tree like this:
A
+-1
+-i
+-2
+-ii
B
+-1
+-ii
C
+-3
+-i
+-5
+-iv
I am trying actually to convert the above table into a multidimensional array.
Then the array will be convertet to a tree using <ul>.
You can see the result here : http://www.e-forologia.gr/seminaria/new,
but this is not done exactly with this way. I used recursive functions.
I want to make a class to pass the table and return this
function Table2Array($TreeTable) {
$iDepth=mysql_num_fields($TreeTable);
$iRows=mysql_num_rows($TreeTable);
/*Create Field array*/
$arFields=Array();
for($i=0; $i<$iDepth; $i++){
${arField.$i}=Array();
array_push($arFields,${arField.$i});
}
while($arRow=mysql_fetch_array($TreeTable)) {
for($i=0; $i<count($arFields); $i++) {
array_push($arFields[$i],$arRow[$i]);
}
}