Forum Moderators: coopster
am not really getting a neat way of doing it.I dont want to echo tag like "echo "</td><td>";
$executor=@mysql_fetch_array($result);
if ($row=mysql_fetch_array($result)) {
$out = '
<table width="634" align="center" class="FormInput">
<tr><td width="193">Mr/Mrs/Miss</td>
<td width="442">' . $row['Mr'] . '</td></tr>
<tr><td width="193">Sur Name</td>
<td width="442">' . $row['surname'] . '</td></tr>
<tr><td width="193">Other Names</td>
<td width="442">' . $row['othernames'] . '</td></tr>
</table>
'; // end of OUT
}
else { $out = "<p>There are no records to display.</p>"; }
echo $out;
$fields = Array(
'Mr/Mrs/Miss' => 'Mr',
'Sur Name' => 'surname',
'Other Names' => 'othernames'
);
if ($row=mysql_fetch_array($result)) {
$out = '
<table width="634" align="center" class="FormInput">
';
foreach ($fields as $key=>$value) {
if (isset($row[$value]) and ($row[$value] != '')) {
$out .= '<tr><td width="193">' . $key . ' </td><td width="442">' .
$row[$value] . '</td></tr>';
}
}
$out .= '
</table>
'; // end of OUT
}
else { $out = "<p>There are no records to display.</p>"; }
echo $out;