Author Topic: db loop with n-deep  (Read 668 times)

0 Members and 1 Guest are viewing this topic.

Sven

  • Guest
db loop with n-deep
on: Fri, 22. November 2002 - 14:09:25
hello

i must coding a db query/loop with a x-deep
my db design

id |  text        |  topid  |  sort
1  |  text1      |   -1     |   1
2  |  text2      |   -1     |   2
3  |  subtext1 |    1     |  1
4  |  subtext2 |    2     |   1
5  |  subtext3 |    3     |   1

text1
__subtext1
____subtext3
text2
__subtext2


how can i coding this special tree/submenue ??

i dont have any idea

thx for helping :)

cu
sven

releasedj

  • Guest
db loop with n-deep
Reply #1 on: Sun, 24. November 2002 - 18:26:51
I can't really tell you how to do this.

I can advise you to avoid using nested loops, as you could never get them to dynamically nest the amount you want.
I can advise you to put them all in one loop, and to maybe pass through the variables that will allow you to display them differently; what I mean is to try using php for all of the logic.. not the template.

I hope this helps. I can't really go any further as this is a generic php problem, it's up to you how you deal with it.

Regards,

Kelvin