我已经使用 MySQL Table 获取表上的值,该值使用了另一个表。我得到了数组值
第一个表查询:
$ordersdetail = "SELECT * FROM `order_item` WHERE `Order_ID`='".$orderid ."'";
$customerorder = mysql_query($ordersdetail );
$i=0;
while($rows = mysql_fetch_array($customerorder ))
{
$orderproduct= $rows['Order_product_ID'];
$orderids= $rows['Order_ID'];
$productId[$i] = $rows['Product_ID'];
$sizeId[$i] = $rows['Size_ID'];
$colorId[$i] = $rows['Color_ID'];
$quantiy = $rows['Order_Quantity'][$i];
$price = $rows['Unit_Price'][$i];
$subTotal = $rows['Sub_Total'];
$customerccode = $rows['Record_Status'];
$customerphone = $rows['Created_Time'];
$i++;
}
表列 productid 数组值被另一个表使用:
给定:
for($i=0;$i<count($productId);$i++)
{
$product = "SELECT * FROM `product` WHERE `Product_ID`='".$productId[$i]."'";
$products = mysql_query($product);
while($rows = mysql_fetch_array($products))
{
$productnames = $rows['Product_Name'];
}
}
color id used :
for($i=0;$i<count($colorId);$i++)
{
$color = "SELECT * FROM `color` WHERE `Color_ID`='".$colorId[$i] ."'";
$cname = mysql_query($color);
while($rows = mysql_fetch_array($cname))
{
$colorname = $rows['Color_Name'];
}
}
同样的方式使用值表
我的问题值显示表继续
table structure
$message .= "<table width='100%' border='1' cellspacing='0' cellpadding='1'>
<thead>
<tr style='background: #eee;'>
<th><strong>Quantity</strong> </th>
<th><strong>ProductName</strong> </th>
<th><strong>Size</strong> </th>
<th><strong>Style</strong> </th>
<th><strong>Price</strong> </th>
<th><strong>Total</strong> </th>
</tr>
";
for($i=0;$i<count($productId);$i++)
{
$message .=" <tr style='color: #c40000;'>
<th>" .$quantiy. "</th>
<th>" .$productnames. "</th>
<th>" .$sizename. "</th>
<th>" .$colorname. "</th>
<th>" . $price. "</th>
<th>" . $subTotal. "</th>
</tr>";
}
这种格式是正确的 更多的值不显示只第一个值显示多次