我正在使用以下查询来填充表:
$result = mysql_query("SELECT vendor, part_number, machine, Sum(q_received) AS received, Sum(q_rejected) AS rejected FROM qa_parts Group by vendor, part_number, machine Order by vendor ASC");
我想按供应商对结果进行分组,然后在供应商下显示来自他们的所有部件及其详细信息。
这就是我需要它做的事情:
http://www.gen-techno.com/images/old.jpg
它现在在做什么:
http://www.gen-techno.com/images/new.jpg
如您所见,供应商 OPS 产品的部件并未像上述 Allied Electronics 示例中的部件一样归入该供应商之下。
截至目前我的表格代码:
while($row = mysql_fetch_array($result))
{
echo "<h4>" . $row['vendor'] . "</h4>[fancy_table]<table>
<tr>
<th>Part Number</th>
<th>Quantity Received</th>
<th>Quantity Rejected</th>
<th>Machine</th>
</tr>";
echo "<tr>";
echo "<td>" . $row['part_number'] . "</td>";
echo "<td>" . $row['received'] . "</td>";
echo "<td>" . $row['rejected'] . "</td>";
echo "<td>" . $row['machine'] . "</td>";
echo "</tr>";
echo "</table>[/fancy_table]";}