Simple PHP/MySQL/CSS Family Tree code
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Hi friends

I have 2 MySQL tables, I want a simple PHP code that can automatically generate a family tree of relationships. i.e. PHP/code that can allow a dynamic vertical family tree to be generated. The tree can grow downwards from great grandfather to even great grand-children.

Below are the 2 tables. Note that the connections table handles the relationships

TABLE 1: PEOPLE


NO NAME TYPE
1 Person_Id Primary bigint(20)
2 Pass_Word blob
3 First_Name varchar(255)
4 Last_Name varchar(255)

TABLE 2: CONNECTIONS


NO NAME TYPE
1 Connection_Id Primary bigint(20)
2 Primary_Person_Id bigint(20)
3 Secondary_Person_Id bigint(20)
4 Connection_Type enum('Husband', 'Wife', 'Son', 'Daughter', 'Mother','Father', 'Grandfather', 'Grandmother', 'Aunt', 'Uncle', 'Cousin','Niece', 'Nephew', 'Grandson', 'Granddaugher', 'Sister', 'Brother', 'Great-grandfather', 'Great-grandmother', 'Great-grandson', 'Great-granddaughter')

Thanks!!

Are all the people in the table connected? Or would there be separate nodes/trees? Can it be assumed that all people are linked in the CONNECTIONS table through some parent-children path? Eg. can there be a cousin relationship, with no way of knowing which parent they're related through, etc?
aljgom 8 months ago
Hi, there would be separate nodes. Yes, so there will be cousins with no way of knowing which parent.
jobokoth 8 months ago
awarded to remotedevske

Crowdsource coding tasks.

1 Solution

Winning solution