Hello,
I have the following function:
function GetList($Value)
{
$order_items_List = Array();
$Database = new DatabaseConnection();
$query = "select * from order_items where (IOrderID = $Value)";
// echo $query;
$Database->Query($query);
for ($i=0; $i < $Database->Rows(); $i++)
{
$order_items = new order_items();
$order_items->Get($Database->Result($i,"IOrderID"));
$order_items_List[] = $order_items;
}
return $order_items_List;
}
The query is correct and returns two records. The problem is when I try to display the results I get two instances of the first record and not both records.
Here's what I'm using to display
$items = new order_items();
$itemslist = $items->GetList(10);
foreach ($itemslist as $items)
{
echo "<tr>";
echo "<td class=\"list\" height=\"25\">".$items->ItemID."</td>";
echo "<td class=\"list\" height=\"25\">".$items->ISKU."</td>";
echo "<td class=\"list\" height=\"25\">".$items->IDescription."<br /></td>";
echo "<td class=\"list\" height=\"25\"> </td>";
echo "<td class=\"list\" align=\"right\" height=\"25\">".$items->IPrice."</td>";
echo "<td class=\"list\" align=\"right\" height=\"25\">".$items->IPriceExtended."</td>";
echo "</tr>";
}
Can anyone see where I'm going wrong?