Forum Moderators: coopster
while ($myrow=mysql_fetch_array($result)) {
$rows .= '<tr>';
foreach ($fields as $var) {
$rows .= '<td>' . $myrow[$var] . '</td>';
}
$rows .= '</tr>';
}
//
if ($rows) {
echo '<table>';
// The first is the column HEADER for the table.
// Note ONE LESS than count, arrays are zero based
// and a count is one more than the last index.
$rows .= '<tr>';
for ($i=0;$i<count($fields)-1;$i++) {
echo '<td>' . $fields[$i] . '</td>';
}
echo '</tr>';
echo $rows;
echo '</table>';
}
else { echo '<p>No results were found.</p>'; }
while ($myrow=mysql_fetch_array($result)) {
$rows .= '<tr>';
for ($i=0;$i<count($rows)-1;$i++) {
$rows .= '<td>' . $myrow[$i] . '</td>';
}
$rows .= '</tr>';
}
// the same if/else follows