Here is what I want to do but I’m having a hell of a time figuring out a direction to go.
Mysql Table has id and parent id
I don’t want a tree, I don’t want a menu I’m looking for a <a href=" " > statement filled with a single query no limit to levels of how deep the id and parent id can go.
So here I want to generate a query that goes in normal english.
select id from table_name check if it’s has a parent then check to see what the parents id is and then check for that parents id and so on and so forth.
so it would look like
table example
[TABLE=“width: 200”]
[TR]
[TD]id[/TD]
[TD]parent id[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]0(dnotes parent)[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1[/TD]
[/TR]
[/TABLE]
output would be for the folder id of 3
<a href =“3/2/1”>file</a>
why this way because I’m storing file locations with no depth and the file table has a folder id, so I need to take that folder id and find the child folders back to parent.
Why is it so confusing in my head and when I read about it, it only gets worse. And any example I find is for a tree view so I need to be able to assign this to an array to get the directory path at the end.