0

What I'm basically trying to do is iterate through multi-tier data on MySql. As an example. I have Item1 Item2 and Item3. Each Item has the possibility to have a Secondary Item. Each Secondary a Tertiary and so on and so forth. The Secondary and Tertiary items are also normal Items such as Item1 2 and 3. At first I assumed I could use a Multidimensional Array, but I couldn't figure out how to iterate and make each level through the iteration, nor how if I did achieve this, a good way to access everything afterwords. The end goal here is to have it fetch the data and the present it like so:

$Primary1
   $Secondary1
   $Secondary2
      $Tertiary1
$Primary2
   $Secondary1
$Primary3
   $Secondary1
   $Secondary2
   $Secondary3
      $Tertiary1
      $Tertiary2

...and so on...

The database sides of things has each item as a row in a table, and lists the sub items it requires. The sub items are also just rows in the same table with its own sub items.

Any help/advice would be greatly appreciated. Thanks

EDIT:

In terms of using a Hierarchical Structure: Its not really a hierarchical system. For example a Tertiary item could be a Primary Item elsewhere and vice versa. Each item has the potential to be in any position and will show up in many situations not just one.

WatsonB
  • 3
  • 2

0 Answers0