[HELP] retrieve TREE structure from mysql db

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ghiro

    [HELP] retrieve TREE structure from mysql db

    as subiect says, i already know how to print a tree structure using a
    recursive function but what i want is to save the results in a
    multidimensiona array so i will be able to format them in a table with
    graphic etc

    the funciont that i am using to simple print the structure is:

    function display_childre n($parent, $level) {
    // retrieve all children of $parent

    $result = mysql_query('SE LECT titolobreve,id FROM categorie '.
    'WHERE parent="'.$pare nt.'";');

    // display each child
    while ($row = mysql_fetch_arr ay($result)) {
    // indent and display the title of this child
    echo str_repeat('- ',$level).$row['titolobreve']."\n<br>";

    display_childre n($row[id], $level+1);
    }
    }

    thanks!!!



Working...