Jump to content

embedded while loop


sbrinley

Recommended Posts

I am trying to take a list of data with two columns and separate it out into a structured table. Here is a sample list of the data

 

Parent Child

D61120901GAT R61120901GAT

R61120901GAT R61120801GAT

R61120801GAT R61120801GAA

R61120801GAA R61120701GAT

R61120701GAT R61120601GAT

R61120601GAT R61120501GAT

R61120501GAT R61120003GAT

 

This is the list I want to turn into this

 

D61120901GAT

R61120901GAT

R61120801GAT

R61120801GAA

R61120701GAT

R61120601GAT

R61120501GAT

R61120003GAT

 

The parent might have up to 10 children deep in total. Also the parent might have two or more direct children.

for example:

 

D61120901GAT

R61120901GAT

R61120801GAT

R61121901GAT

R61121801GAT

 

Also even though the numbers seem to go into order here they don't in every part. A typical list size is about 20k lines long.

 

I've tried a few different while loops without success. I fear I might be over complicating it or not looping correctly. If anyone has some ideas or a solutions I would appreciate it!

Link to comment
https://forums.phpfreaks.com/topic/158977-embedded-while-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.