Results 1 to 17 of 17
Dec 6, 2013, 19:30 #1
- Join Date
- Sep 2004
- Bowie MD
- 1 Post(s)
- 0 Thread(s)
Resursive, Single Query??? Parent Child Loop?? Directory folder id.... ugh
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
id parent id 1 0(dnotes parent) 2 1 3 2 4 1
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.If it works don't fix it. If it's broke fix it.
He who knows all is the smartest.
He who doesn't know anything isn't dumbest.