Hi guys,
Im trying to figure out how i can display a query result without displaying the same info twice.
Lets say i have a DB with 2 tables. Table1 & Table2.
TABLE 1
customer_id l company_name l address l
TABLE 2
id l equip_id l hardware l expiry l
The ‘customer’ and ‘id’ field are the primary keys. ‘equip_id’ and ‘customer_id’ are the same. So a customer is listed in table 1 but all their hardware is listd in table 2 and item per row, so there will be multiple equip_id’s of the same value for each customer.
I’ve got my query working great thanks to help from this forum but i can seem to format the output how i want.
im after:
company_name
_____________hardware l expiry
_____________hardware l expiry
company_name
_____________hardware l expiry
_____________hardware l expiry
and so on…
this is what i have now but it lists the company name for every hardware item.
<?php QUERY HERE ?>
<table id="cust_table">
<th>Company</th>
<th>Manufacturer</th>
<th>Description</th>
<th>Expiry Date</th>
<?php
if ($num_rows < 1) {
echo "No match found! Please go back and try again.";
} else {
while ($row = mysql_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $row['company_name']; ?></td>
<td><?php echo $row['manufacturer']; ?></td>
<td><?php echo $row['description']; ?></td>
<td><?php echo $row['end_date']; ?></td>
</tr>
<?php
}
}
?>
</table>