stalian4002 Posted January 18, 2009 Share Posted January 18, 2009 hi i am trying to make a family tree website using php mysql, i have the following tables im not sure if its correct or if i am going the right way about it, can someone help me out please. i am using phpmyadmin i have 5 tables: USERS: user_id (PK) username password firstname lastname email FAMILY_TREE: user_id(FK) family tree name description family tree ID(PK) FAMILY_MEMBERS: family memberID(PK) firstname lastname date of birth date of death place of birth place of death gender family treeID(FK) motherID(FK) fatherID(FK) MOTHERS: motherID(PK) mother of family(FK) mothers userID(FK) FATHERS: fatherID(PK) father of family(FK) fathers userID(FK) user table: has web users details and stores password family tree table: holds family tree id making it unique family member: will hold all members of the family mothers: will hold into who is whos mother father: will hold into who is whos father i just wanted to know if my table structure is correct and if im going the right way about it. can someone also help me with sql join query [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/ Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 You don't need MOTHERS nor FATHERS table. Just make motherID and fatherID reference memberID in FAMILY_MEMBERS Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-739685 Share on other sites More sharing options...
stalian4002 Posted January 18, 2009 Author Share Posted January 18, 2009 this is how my tables look like, http://img232.imageshack.us/img232/7355/relationshipkf8.jpg Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-739706 Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 I'm maintaining my opinion. Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-739761 Share on other sites More sharing options...
stalian4002 Posted January 18, 2009 Author Share Posted January 18, 2009 i have deleted mothers and fathers table did you mean something like this http://img206.imageshack.us/img206/6738/relationship2ws8.jpg Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-739819 Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 Yes. Something like that should work better IMHO You should however be prepared for cases of unknown parents. (NULL entries ?) Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-739827 Share on other sites More sharing options...
stalian4002 Posted January 18, 2009 Author Share Posted January 18, 2009 im sorry i dont understand i am a beginner at this can you give me a brief description on what you mean, many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-739832 Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 I mean: how are you going to store information about a person, whose parents (one or both) are unknown. One thing that comes to mind is to set MotherID and/or FatherID to NULL. But you could come up with other solutions. Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-740008 Share on other sites More sharing options...
stalian4002 Posted January 18, 2009 Author Share Posted January 18, 2009 many thanks once again. juss wanted help in sql query in how to find half siblings and cousins Quote Link to comment https://forums.phpfreaks.com/topic/141325-beginner-mysql-help/#findComment-740082 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.