What I wrote was for the second line. In PHP you would use...
PHP Code:
<table>
<tr>
<th scope="col">Loan Number</th>
<th scope="col">Type 1</th>
<th scope="col">Type 2</th>
etc.
<?php
$sql = mysql_query("SELECT DISTINCT loan_number FROM table");
while ($loandetail = mysql_fetch_object($sql)) {
$sql2 = mysql_query("SELECT call_type FROM table WHERE loan_number = '$loandetail->loan_number'");
print "</tr>";
print "<tr>";
print "<td>".$loandetail->loan_number."</td>";
while ($call = mysql_fetch_object($sql2)) {
print "<td>".$call->call_type."</td>";
}
}
?>
</tr>
</table>
You'd have to either limit the number of table rows or create a typical table ie. print the number of columns required on the fly.