Jump to content

Tree in php


emont

Recommended Posts

Hi, since a few weeks i've been trying to solve this issue:

 

I have 2 Mysql tables, like this:

 

CV

   

ID

   

Name

 

 

   

1

   

CHARLES JOHNSON

 

   

2

   

VIVIAN CLEMENTI

 

   

3

   

ROBERT CIFUENTES

 

   

4

   

CARLA CIFUENTES

 

   

5

   

VICTOR OTERO

 

   

6

   

PAUL MCOR

 

   

7

   

VICTORIA GULL

 

 

and the parents table

 

PARENT

 

 

   

IDMOTHER

   

IDFATHER

   

IDSON

 

 

   

2

   

3

   

7

 

 

   

4

   

1

   

3

 

 

   

[/td]

    [td]6

   

1

 

 

and I need to build a tree with this to show it in the web browser, how can i do this?. I really appreciate your help.

Link to comment
Share on other sites

More general you will need to do something different

You have at able of people 1 table will do

 

PersonID P-Key

FatherID Father's Id

MotherID Mother's ID

Level starts at 0 then people that are born are person before +1

 

then just query it off order by the level and you are set for the strucural query to output in a while loop

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.