I have following kind of data to table:
id parent_id child_id level
1 53987 52548 1
2 60764 52548 2
3 60764 53987 1
4 60764 59695 2
5 63457 59695 1
6 60764 63457 1
So, how i can get data by recursively with level and store data to array like ['child_id','parent_id',level]. I need help for writting query and generate the tree.
Note: I can't change the database's table structure. I must need tree based on given table structure.