Tanja Posted October 28, 2016 Share Posted October 28, 2016 I´m using Barands pedigree to draw, but if there are unknown ancestors it won´t be work correct. // print parent trees, sire then dam if ($N < $max) { $sql = "SELECT a.father_id, a.mother_id, s.dogname, d.dogname FROM dog a INNER JOIN dog s ON a.father_id = s.id INNER JOIN dog d ON a.mother_id = d.id WHERE a.id = '$dogid' "; $res = mysql_query($sql); list($s, $d, $sn, $dn) = mysql_fetch_row($res); printTree($s, $sn, $N+1, $max); printTree($d, $dn, $N+1, $max); } For example, if a dog has no father and the father_id is NULL -> possible mother isn´t show too (and calculation of avk isn´t right (is 200% should be 100%)).If I change the unknown father_id to 0 it will be the same.If i change to an id which stands for unknown father (for exampe 500) it will be all correct - but if there are more than one ancestors missing, calculating is bad ....My questions: How is the best way to handle unknown ancestors? For each dog seperatly unknown father / mother? Or other way?And how to change code above? Quote Link to comment https://forums.phpfreaks.com/topic/302420-mysql-pedigree-unknown-ancestors/ 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.