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
https://forums.phpfreaks.com/topic/79284-tree-in-php/
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
https://forums.phpfreaks.com/topic/79284-tree-in-php/#findComment-401321
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.