Hi, Maybe it would be better not to use a multidimentionnal array in a db. You should create to additionnal columns that stores the ParentID of the row. It's the easiest way to do it. Also you can create another table that would translate from numbers to text, or just put the text. Stephen wrote: > > I am having most of my problems because I am trying to do this walking > through the data a single time, with the assumption any records parentID > has an ID less than the child and therefore would already be populated in > the array... > > On Sun, 21 Jan 2001, Stephen wrote: > > > Date: Sun, 21 Jan 2001 23:49:13 +1100 (EST) > > From: Stephen <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: [PHP-DB] select with parentID field into multidimensional array? > > > > Hi > > > > I have a table which is set out like this > > > > ID name parentID > > > > I "select * from table" into $result. > > > > I then wish to walk through the result such that it creates a > > multidimensional array sorted with children under parents. Here is a basic > > eg. > > > > ID name parentID > > 1 books 0 > > 2 movies 0 > > 3 songs 0 > > 4 horror 1 > > 5 love 1 > > 6 horror 2 > > 7 love 2 > > 8 scifi 2 > > 9 IT 4 > > > > etc > > > > I am trying to write a function that would then insert these into a > > multidimensional array as such... > > > > $array[1] = "books"; > > $arary[1][4] = "horror"; > > $array[1][4][9] = "IT"; > > > > etc, so I could pull them out into a select dropdown list nicely sorted. > > > > I am not sure how to write an array function with an unlimited number of > > levels. If someone could help out it would be greatly appreciated. > > > > Thanks > > Stephen > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > email: meridian at tha net > web: meridian.on.tha.net > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]