我有以下脚本,它是一个订单列表:
<?php
$manifest_query = tep_db_query("SELECT o.franchise_id, o.orders_id,
o.customers_id, o.delivery_name, o.delivery_street_address [...]");
while ($manifest = tep_db_fetch_array($manifest_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>
<?php
$products_query = tep_db_query("select products_model, products_name, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$manifest['orders_id'] . "'");
while ($products = tep_db_fetch_array($products_query)) {
?>
<td><?php echo$products['products_quantity'] . ' x ' . $products['products_name'] .
'<br> ' . ' '.$products['products_model'] .'<br>';?></td>
<?php
}
?>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"></td>
</tr>
<?php
}
?>
打印$products
变量的单元格每次都会重复,作为一个新的 td,但如果有超过 1 个产品,我需要它在一个 td 中打印所有产品。我有点糊涂了?