i want to create a family tree website in which members can be added dynamically through backend. I am usin php-mvc,mysql. I am adding members through backend and I have 4 tables 1. members-details of members and also father,mother ids; 2 partner-to show partner relationships 3 child - to show child relationships 4 sibling - to show sibling relationships
My table structure Members
CREATE TABLE IF NOT EXISTS `members` (
`members_id` int(10) NOT NULL AUTO_INCREMENT,
`members_family` int(10) NOT NULL,
`members_first_name` varchar(500) NOT NULL,
`members_sur_name` varchar(500) DEFAULT NULL,
`members_gender` int(10) DEFAULT '0' COMMENT '0-notset,1-male,2-female,3-transgender',
`members_birth_date` date DEFAULT NULL,
`members_is_living` int(10) DEFAULT NULL,
`members_death_date` date NOT NULL DEFAULT '0000-00-00',
`members_email` varchar(1000) DEFAULT NULL,
`members_mobile` varchar(500) DEFAULT NULL,
`members_telephone` varchar(500) DEFAULT NULL,
`members_website` varchar(1000) DEFAULT NULL,
`members_blog` varchar(1000) DEFAULT NULL,
`members_skype` varchar(1000) DEFAULT NULL,
`members_address` varchar(5000) DEFAULT NULL,
`members_birth_place` varchar(1000) DEFAULT NULL,
`members_death_place` varchar(1000) DEFAULT NULL,
`members_profession` varchar(1000) DEFAULT NULL,
`members_company` varchar(1000) DEFAULT NULL,
`members_interests` varchar(5000) DEFAULT NULL,
`members_notes` varchar(1000) DEFAULT NULL,
`members_father` varchar(10) DEFAULT NULL,
`members_mother` int(10) DEFAULT NULL,
`members_generation` int(10) DEFAULT NULL,
`members_status` int(10) NOT NULL,
`members_image` varchar(1000) DEFAULT NULL,
`members_inserttime` datetime NOT NULL,
`members_updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`members_id`)
)
Partner
CREATE TABLE IF NOT EXISTS `partner` (
`partner_id` int(10) NOT NULL AUTO_INCREMENT,
`partner_member` int(10) NOT NULL,
`partner_of_member` int(10) NOT NULL COMMENT 'partner of which member in members_table',
`partner_relation_status` int(10) NOT NULL COMMENT '1-current,2-ex-partner',
`partner_status` int(10) NOT NULL,
`partner_inserttime` datetime NOT NULL,
`partner_updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`partner_id`)
)
child
CREATE TABLE IF NOT EXISTS `child` (
`child_id` int(10) NOT NULL AUTO_INCREMENT,
`child_member` int(10) NOT NULL,
`child_of_member` int(10) NOT NULL,
`child_status` int(10) NOT NULL,
`child_inserttime` datetime NOT NULL,
`child_updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`child_id`)
)
sibling
CREATE TABLE IF NOT EXISTS `sibling` (
`sibling_id` int(10) NOT NULL AUTO_INCREMENT,
`sibling_member` int(10) NOT NULL,
`sibling_of_member` int(10) NOT NULL COMMENT 'sibling of which member in mebers table',
`sibling_relation` int(10) NOT NULL COMMENT '1-younger,2-elder',
`sibling_status` int(10) NOT NULL,
`sibling_inserttime` datetime NOT NULL,
`sibling_updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`sibling_id`)
)
I am adding values to this table . Now I need to show this as a tree structure. I didnt get any idea from my searchings, Can anyone help me to traverse data as a family tree .