I need the following to only print the customer once and all the referals for that customer beneath it.
PHP Code:
$sql = "SELECT customers.customer_last_name,customers.customer_first_name,customers.customer_id,customer_referals.ref_home_phone,customer_referals.ref_first_name,customer_referals.ref_last_name,customer_referals.ref_address,customer_referals.ref_city,customer_referals.ref_state,customer_referals.ref_zip FROM customers,customer_referals
WHERE customers.customer_id=customer_referals.customer_id ORDER BY customer_id";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_array($result)) {
$customer_id = $myrow["customer_id"];
$customer_first_name = $myrow["customer_first_name"];
$customer_last_name = $myrow["customer_last_name"];
$ref_address = $myrow["ref_address"];
$ref_city = $myrow["ref_city"];
$ref_state = $myrow["ref_state"];
$ref_zip = $myrow["ref_zip"];
$ref_last_name = $myrow["ref_last_name"];
$ref_first_name = $myrow["ref_first_name"];
$ref_home_phone = $myrow["ref_home_phone"];
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>";
}