PDA

Click to See Complete Forum and Search --> : adjacency listing?


phpman
May 6th, 2003, 12:26 PM
well let me try to expalin what I am trying to do.

I have a db table like so

subcategory1


subid1 categoryID1 fatherID name
1 20 0 link4
2 0 1 link5
3 0 2 link6
4 0 3 link7


so it is explained like so. link4 is assocciated with link3 by categoryID1 which is 20 (id of category link3, another table) and link5 is assocciated to link4 by fatherid and link6 is assocciated to link5 by fatherID and so on. this is called adjacency list method I think.

so with that table layout I can produce code like so

link / link2 / link3 / link4 /
link / link2 / link3 / link4 / link5
link / link2 / link3 / link4 / link5 / link6
link / link2 / link3 / link4 / link5 / link6 / link7

and link - link3 is another table but we don't have to worry about it right now.

so the code attached works a charm for something like this, but when you add say link5.5 to the db and associate it to link5 then link7 gets booted out. according to the code it queries the db depending on the last subid1 of the last link. this would get link5.5 and link6 and nothing else



subid1 categoryID1 fatherID name
1 20 0 link4
2 0 1 link5
3 0 2 link6
4 0 3 link7
5 0 2 link5.5

can you see what I am getting at? I need a way to get all of them that are associated to link4.

any takers on this?

phpman
May 8th, 2003, 10:41 AM
13 people looked at it and nobody downloaded it. hmm I must be the greatest php'er in the world. nobody can answer my questions. :(