codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  tree  sasha85 at 10:21 on Tuesday, October 16, 2007
 


i am tring to build something like family tree
i wrote the code below and get endless herizonatl line of the head of the family...
help please!:)


imagen old and nice grandpa he got 5 sons and 4 daughters
(4+5=9)
every one of the sons got 5 sons
(5x5=25)
and every one of the daughters got 2 sons and 2 daughters
(2+2=4)
(4x4=16)
that means the grandpa got 16+25=41 grandchildren...

=>on the 1(first) level he got 9people
=>on the 2(second) level he got 41people

and may be some of the children got sons or daughters too...in that case he will got a 3(third) level too...


in my asp files, there are no replay of names=every body got his original name wich no one esle have.
i enter to the database :
"name"=firstname "gen"=personal letters key "father"=fathers personal letters key




dim level
sub GetTree(gen)


dim mySQL1, conntemp1, rst1

mySQL1="SELECT * FROM mag WHERE father='" & gen & "'"
call getFromDatabase(mySQL, rst1, "/forum/ciss.html")


if ((not rst1.EOF) and (not rst1.BOF)) then

while not rst1.EOF

for cc=1 to level
Response.Write "&nbsp"
Response.Write "&nbsp"
next

Response.Write rst1("name")
Response.Write "<br>"
level = level + 1
GetTree(rst1("agentcode"))
level = level - 1

rst1.movenext
wend
end if

Set rst1 = Nothing
end sub








level = 1
dim vab, mySQL, conntemp, rst
vab="Wewdrtdewew"
mySQL="SELECT * FROM mag WHERE gen='" & vab & "'"
call getFromDatabase(mySQL, rst, "/forum/cittss.html")


rst.movefirst

level=0
while not rst.EOF

for cc=1 to level
Response.Write "&nbsp"
Response.Write "&nbsp"
next

Response.Write rst("username")
Response.Write "<br>"

level=level+1
GetTree(rst("gen"))
level=level-1

rst.movenext

wend






<Added>

i changed this line "GetTree(rst1("agentcode"))"
to "GetTree(rst1("gen"))"

<Added>

well, this shows all the rows...but in one column...
how can i make this structure?

[QUOTE]
A
| |
B C
/\
D E


[/QUOTE]








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Insert Contents of .txt file into a .html page
•  Re: Perl regular expression problem.
•  Re: Problems in login using WWW::Mechanize
•  searching for gd::graph guide
•  Re: ARRAY OF HASHMAPS
•  Adv. Regexp or Otherwise
•  Adv. Regexp or Otherwise
•  I need help pleasee! My project is about using I/o Stream
•  Help Running VB script in Windows 2003


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008