I have a table dogs
dogID ( all the dogs )
sireID ( the dog that is the father )
damID ( the dog that is the mother )
regname ( name of the dog )
I have a tab on the view page "known offspring"
I created a snippet in the tab
and placed the following code ( based on example in manual )
global $dal;
$tblOrders = $dal->Table("dogs");
$rs = $tblOrders->Query("sireID=".$_REQUEST["editid1"],"");
$data = db_fetch_array($rs);
$CustomerID = $data["sireID"];
echo "<font size='1'><i>based on dogs entered in the system</i></font>
";
$rsOrders = $tblOrders->Query("sireID='".$CustomerID."'","");
while($data=db_fetch_array($rsOrders))
{
echo "<a href=dogs_view.php?editid1=".$data["dogID"].
">". $data["regname"]."</a>
";
}
I don't get any results with this?
I have this working with a different tab in the person table where it looks up all the dogs the person owns.
global $dal;
$tblOrders = $dal->Table("dogs");
$rs = $tblOrders->Query("owner=".$_REQUEST["editid1"],"");
$data = db_fetch_array($rs);
$CustomerID = $data["owner"];
echo "<font size='1'><i>based on dogs entered in the system</i></font>
";
$rsOrders = $tblOrders->Query("owner='".$CustomerID."'","");
while($data=db_fetch_array($rsOrders))
{
echo "<a href=dogs_view.php?editid1=".$data["dogID"].
">". $data["regname"]."</a>
";
}
That works -
I also will be doing this for another tab in the dogs view where it will list all the breedings the dog has done
this will need to look up based on dogID and gender
So if the gender is female - it looks up all the males that the female has been bred to
and if the gender is a male - it looks up all the females that it has been bred to...
dogID - dogs in the table
sireID - sires in the table
damID - dams in the table
gender - Male / Female
I am stumped on this - any help would be greatly appreciated.