我已應用查詢以根據名稱和日期在表中顯示訂單詳細信息。它顯示的數據correct.Right現在它的顯示數據是這樣的:訂單明細顯示ORDER BY日期和名稱
但現在我想在格式,我可以按日期這樣的事情看到來自同一個客戶的訂單,以顯示我的數據:
ABC ordered on Date:20/05/15
ItemName | Size | Quantity | Color
item1 | XL | 7 | yellow
item2 | L | 3 | pink
item3 | S | 1 | green
XYZ ordered on Date:13/09/15
ItemName | Size | Quantity | Color
item1 | L | 8 | brown
item2 | L | 3 | pink
item3 | S | 4 | green
任何建議或幫助將很可觀
代碼
echo" <table border='3px' bordercolor='#333333' >";
$query="select orders.date,order_detail.quantity,order_detail.price,order_detail.color,order_detail.size,customers.name,products.product_name,products.product_image from order_detail JOIN orders on orders.serial=order_detail.orderid Join customers on customers.serial=orders.customerid Join products on products.productid=order_detail.productid ";
$sql=mysqli_query($con,$query);
while($row=mysqli_fetch_array($sql))
{
?>
<tr>
<td><?php echo $row['name'] ?> </td>
<td><?php echo $row['date'] ?></td>
</tr>
<th>Product</th>
<th>Name & quantity</th>
<th>Color</th>
<th>Price</th>
<th>Size</th>
<tr>
<td><image width="80px" height="90px" src="\images<?php echo $row['product_image'] ?>"/></td>
<td><?php echo $row['product_name']. "*". $row['quantity']?></td>
<td><?php echo $row['color'] ?></td>
<td><?php echo $row['price'] ?></td>
<td><?php echo $row['size'] ?></td>
</tr>
<?php
} }
?>
</table>
添加順序,如果你能提供一個合適的查詢它會幫助我瞭解更多 – tabia