I have table like this :
+---------+----------+--------------+-----+ | Childid | parentId | refGParentId | Name| +---------+----------+--------------+------ | 1 | 0| 0 | a| | 2 | 1| 1 | b| | 3 | 1| 1 | c| | 4 | 2| 1 | b1| | 5 | 2| 1 | b2| | 6 | 3| 1 | c1| | 7 | 3| 1 | c2| | 8 | 4| 2 | x | | 9 | 4| 2 | x | | 10 | 5| 2 | y | | 11 | 5| 2 | y | | 12 | 7| 3 | w | | 13 | 7| 3 | w | +------+----------+--------------+--------+
And I want like this structure format (Tree format) in php & mysql..