Posted by Chung Leong on 04/05/06 19:39
Stephanie Le Gall wrote:
> Hello,
>
>
> I'm using a recursive function to get an array of ID from a database passing
> the array by reference.
>
> I need this structure for the function because the database structure is
> like a tree and there is no limit of level.
Just a suggestion. Retrieving a tree from the database in the manner
you described can be expensive, since every nodes would trigger a
separate query. Usually what I do in a situation like this is to add a
column holding the id to the root of the tree, so that I could retrieve
all the rows at once. Then I use a recursive function to build the
tree.
Navigation:
[Reply to this message]
|