add something along the lines of:
PHP Code:
if($customer_id != $previouscustomerid)
{
echo "<tr><td><a href=\"customer.php?&delete=1&customer_id=$customer_id\"><img src=\"images/delete.bmp\" height=30 width=30></td><td><a href=\"customer.php?&edit=1&customer_id=$customer_id&linkname=$linkname\"><img src=\"images/edit.bmp\" height=30 width=30></td><td><a href=\"customer.php?&display=1&customer_id=$customer_id\"><b>$customer_first_name $customer_last_name<td>$customer_id</td><td></font></b></a></td></tr><tr><td colspan=2></td><td>REFERRED</td><td>$ref_first_name</td><td>$ref_last_name</td><td>$ref_home_phone</td><td>$ref_address</td><td>$ref_city</td><td>$ref_state</td><td>$ref_zip</td></tr>";
}
$previouscustomerid = $customerid;
in place of the echo you have there now.