Jump to content

Please help print this to my web page


Ailis

Recommended Posts

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);
    }
}

Link to comment
https://forums.phpfreaks.com/topic/252949-please-help-print-this-to-my-web-page/
Share on other sites

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);
    }
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.