Hi,
Thanks for your reply,
Fyorl: The data and hierarchy will be placed in the same table. I will feed this information to a Tree component in flex as xml, but formating a php array into an xml is not a problem.
Barand: I have previously managed to create an XML using a similar function but later realized that this will only work if the rows in the database are sorted in a specific way (child node always directly after its parent node). The goal is to be able to move parents and child nodes freely (like in windows explorer for example) meaning that a node with id = 2 could become the child of node with id = 23 for example. This would mean that during the foreach loop nodes might need to be skipped temporarelly until their parents are created. One option would be to recreate nodes every time there is a change in the table, but this could be expensive with hundreds of nodes. Now im just babbling, maybe someone has some ideas :-) I guess im trying to recreate windows explorer :-S. Thanks again for your reply
/Eric