I ve got an inventory table that needs to have certain in each row, and then in the last column in each row, i want to loop out each item that was used per a specific inventory update i.e.
one row would have one column for the customername, one column for the date of the inventory transaction, one for the type of transaction, the specific technician and the last column for the certain products that were used in the update. what i ve got so far loops out the first 4 columns fine, but the last column only gets generated for the first row. code:
<table style="width:92%;">
<tr style="font-size:14px;">
<th style="width:150px;">Customer</th>
<th style="width:110px;">Date</th>
<th style="width:140px;">Tech</th>
<th style="width:50px;text-align:center;">Type</th>
<th>Equipment</th>
</tr>
<?php
$pd_name = array();
$compArray = array();
$prevCompany = ;
$count = 0;
$select = mysql_query("SELECT pd_name, pd_col_name, company FROM item_inventory ORDER BY company ");
while($row = mysql_fetch_array($select)){
$pd_name[$row[ pd_col_name ]] = $row[ pd_name ];
$compArray[$row[ pd_col_name ]] = $row[ company ];
}
$select2 = mysql_query("SELECT * FROM tech_inventory WHERE date >= $date% ORDER BY date DESC ");
while($row2 = mysql_fetch_array($select2)){
$count = 0;
$prevCompany = ;
?>
<tr>
<td><?php echo htmlspecialchars($row2[ customerName ]); ?></td>
<td><?php echo $row2[ date ]; ?></td>
<td><?php echo $row2[ tech ]; ?></td>
<td style="text-align:center;"><?php echo $row2[ type ]; ?></td>
<td>
<table width="200">
<?php
while (list($key, $val) = each($pd_name)){
if($row2[$key] != 0){
if($prevCompany != $compArray[$key]){
?>
<tr>
<td style="text-align:center;"><?php echo $compArray[$key]; ?></td>
</tr>
<?php
$prevCompany = $compArray[$key];
}
?>
<tr>
<td><?php echo $val ?></td>
<td><?php echo $row2[$key]; ?></td>
</tr>
<?php
$count++;
}
}
?>
</table>
</td>
</tr>
<tr><td><?php echo $count; ?></td></tr>
<?php } ?>
</table>