I am using the following query to populate a table:
$result = mysql_query(\"SELECT vendor, part_number, machine, Sum(q_received) AS received, Sum(q_rejected) AS
You need to split your loop into two parts. First part checks if you've got a new/different vendor, and sets up the "outer" setup. Then the inner part which dumps out that vendor's parts.
e.g.
$prev_vendor = null;
while($row = ...) {
if ($row['vendor'] != $prev_vendor) {
... new vendor stuff ...
$prev_vendor = $row['vendor']; // update vendor for next iteration
}
... dump this row's machine data ...
}