Show a list of all orders placed by the current customer on the Order Edit page.
Insert PHP code snippet on the Page Designer screen:
global $dal;
$tblOrders = $dal->Table("Orders");
$rs = $tblOrders->Query("OrderID=".$_REQUEST["editid1"],"");
$data = db_fetch_array($rs);
$CustomerID = $data["CustomerID"];
echo "Orders placed by " .$CustomerID. "<br>";
$rsOrders = $tblOrders->Query("customerid='".$CustomerID."'","");
while($data=db_fetch_array($rsOrders))
{
echo "<a target=_blank href=Orders_edit.php?editid1=".$data["OrderID"].
">". $data["OrderID"]."</a> ".$data["OrderDate"]."<br>";
}
See also:
•Master-details relationship between tables