Tanja Posted January 26, 2013 Share Posted January 26, 2013 On my site i use this http://forums.phpfre...ree#entry323948 chart... Is it possible to get the ids from father and mother to link the names? So that there´s not only "Name" in table - more like <a href="">NAME</a> bit with id-link My english is not so good, excuse me.... Greeting from Germany Link to comment https://forums.phpfreaks.com/topic/273672-pedigree-chart-from-barand/ Share on other sites More sharing options...
Barand Posted January 26, 2013 Share Posted January 26, 2013 That would depend on your database and your code. I can see neither. Link to comment https://forums.phpfreaks.com/topic/273672-pedigree-chart-from-barand/#findComment-1408416 Share on other sites More sharing options...
Tanja Posted January 26, 2013 Author Share Posted January 26, 2013 in database are: id, dogname, father_id, mother_id (and other, but not necassary here) i "update" your script as following: // 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); } I want to link the names, but site will called with id ;-) Link to comment https://forums.phpfreaks.com/topic/273672-pedigree-chart-from-barand/#findComment-1408421 Share on other sites More sharing options...
Barand Posted January 26, 2013 Share Posted January 26, 2013 The output is in the printTree() function. As the id and name are passed to that function you should have no problem creating your link. Although, as you show nothing in the href in the example in your original post, I do not know what you want to link to. Link to comment https://forums.phpfreaks.com/topic/273672-pedigree-chart-from-barand/#findComment-1408423 Share on other sites More sharing options...
Tanja Posted January 27, 2013 Author Share Posted January 27, 2013 at the moment the site is "in work". My example you can look under http://www.wolfdog-database.com/search_dog2.php, type Delphi in filed and search... Later i want to call every other dog over id in url. In Pedigree on Delphis site there are only names, so i cant call with a link the mother. Now there is (for mother) only Name = Chunami, i want to have <a href=dog.php?id=14333>Chunami>/a> to call every dog in pedigree directly.... Link to comment https://forums.phpfreaks.com/topic/273672-pedigree-chart-from-barand/#findComment-1408494 Share on other sites More sharing options...
Barand Posted January 27, 2013 Share Posted January 27, 2013 You need to add a line at the place shown // calculate how many rows the cell should span $rspan = pow(2, $max-$N); $name = "<a href='dog.php?id=$dogid'>$name</a>"; //ADD THIS LINE if ($rspan > 1) echo "\t<td rowspan='$rspan' >$name</td>\n"; else echo "\t<td>$name</td>\n"; Link to comment https://forums.phpfreaks.com/topic/273672-pedigree-chart-from-barand/#findComment-1408502 Share on other sites More sharing options...
Tanja Posted January 27, 2013 Author Share Posted January 27, 2013 Thank you very much! Works perfect! Link to comment https://forums.phpfreaks.com/topic/273672-pedigree-chart-from-barand/#findComment-1408508 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.