Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Database

Show a list of customer orders

Scroll Prev Next More

 

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:

Database API

Master-details relationship between tables

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software