Ailis Posted December 11, 2011 Share Posted December 11, 2011 I have the following code but I cannot get it to print the results of the array into my web page. Help would be so appreciated!! $sql = "SELECT RegName, SireID, DamID FROM pedigrees WHERE ID="; $DoggieIDQ = $sql . $values["ID"]; $DoggieIDR = db_query($DoggieIDQ,$conn); $DoggieID = $_GET['ID']; $Depth = 1; $DepthLimit=8; function getParents($DoggieID, $Depth, $DepthLimit) { $Sire = getSire($DoggieID); $Dam = getDAM($DoggieID); $Depth++; if ($Depth == $DepthLimit) { return array($Sire, $Dam); } else { # Now get grandparents too $SireParents = getParents($Sire, $Depth, $DepthLimit); $DamParents = getParents($Dam, $Depth, $DepthLimit); return array($Sire, $Dam, $SireParents, $DamParents); } } Quote Link to comment https://forums.phpfreaks.com/topic/252949-please-help-print-this-to-my-web-page/ Share on other sites More sharing options...
Drongo_III Posted December 11, 2011 Share Posted December 11, 2011 Hi How far along are you with this? Firstly does that query return anything? Plus in your function you are returning the value but that won't make it appear unless you echo your function or print_r your array. I have the following code but I cannot get it to print the results of the array into my web page. Help would be so appreciated!! $sql = "SELECT RegName, SireID, DamID FROM pedigrees WHERE ID="; $DoggieIDQ = $sql . $values["ID"]; $DoggieIDR = db_query($DoggieIDQ,$conn); $DoggieID = $_GET['ID']; $Depth = 1; $DepthLimit=8; function getParents($DoggieID, $Depth, $DepthLimit) { $Sire = getSire($DoggieID); $Dam = getDAM($DoggieID); $Depth++; if ($Depth == $DepthLimit) { return array($Sire, $Dam); } else { # Now get grandparents too $SireParents = getParents($Sire, $Depth, $DepthLimit); $DamParents = getParents($Dam, $Depth, $DepthLimit); return array($Sire, $Dam, $SireParents, $DamParents); } } Quote Link to comment https://forums.phpfreaks.com/topic/252949-please-help-print-this-to-my-web-page/#findComment-1296896 Share on other sites More sharing options...
dzelenika Posted December 11, 2011 Share Posted December 11, 2011 I think that you omitted to call function getParents Quote Link to comment https://forums.phpfreaks.com/topic/252949-please-help-print-this-to-my-web-page/#findComment-1296898 Share on other sites More sharing options...
Ailis Posted December 11, 2011 Author Share Posted December 11, 2011 HHHMMMM i thought that was what 'getParents' did????? Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/252949-please-help-print-this-to-my-web-page/#findComment-1296962 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.