I have a common database structure using parent_id for a hierarchy.
I'm trying to find out the depth of an item.
So take for example this:
ID Name Parent_id
1 Games 0
2 Nintendo 1
3 DS 2
4 3D 3
If I wanted to find out the depth of ID 4 (3D), the answer is 3. Any idea how I would query this or a combination of sql and php?
Thank you!