我有以下代码:
<?php
$manifest_query = tep_db_query("select o.franchise_id, o.orders_id, o.customers_id, o.delivery_name, o.delivery_street_address, o.delivery_city, o.delivery_postcode, o.delivery_state, o.customers_telephone, o.date_purchased from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot where o.franchise_id = '" . (int)$franchise_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = '5'");
while ($manifest = tep_db_fetch_array($manifest_query))
{
$products_query = tep_db_query("select orders_products_id, orders_id, products_id, products_model, products_name, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$manifest['orders_id'] . "'");
$products = tep_db_fetch_array($products_query);
?>
<tr>
<td height="50" align="center"><?php echo $manifest['orders_id'] ;?></td>
<td cellpadding="2"><?php echo $manifest['delivery_name'] .'<br> '. $manifest['delivery_street_address'] .'<br> '. $manifest['delivery_city'].'<br> '. $manifest['delivery_postcode'].'<br> '. $manifest['delivery_state'].'<br> '. $manifest['customers_telephone'] ;?></td>
<td><?php echo $products['products_quantity'] . ' x ' . $products['products_name'] . '<br> ' . ' '.$products['products_model'];?></td>
<?php
}
?>
$products 在第三列打印分配给订单 ID 的产品。但它只打印分配给订单的第一个产品,即使有多个产品分配给订单。有人知道如何打印 order_id 的所有产品吗?