I have made a table that shows database info in a html table. The table headers gets repeated for every row. Is there a way to make the header only show on top of the table.
<table class="table">
<tr>
<th>ID</th>
<th>Login-ID</th>
<th>Konto typ</th>
<th>Lösenord</th>
<th>Skapad</th>
</tr>
<tr>
<td>' . $row['ID']. '</td>
<td>' . $row['user_id']. '</td>
<td>' . $row['user_type']. '</td>
<td>' . $row['user_pwd']. '</td>
<td>' . $row['user_created']. '</td>
</tr>
</table>
</div>
The <table>
should not be inside the loop.
echo '<div>
<table>
<tr>
<th>ID</th>
<th>Login-ID</th>
<th>Konto typ</th>
<th>Lösenord</th>
<th>Skapad</th>
</tr>
';
foreach ($rows as $row) {
echo '<tr>
<td>' . $row['ID']. '</td>
<td>' . $row['user_id']. '</td>
<td>' . $row['user_type']. '</td>
<td>' . $row['user_pwd']. '</td>
<td>' . $row['user_created']. '</td>
</tr>
';
}
echo '</table>
</div>';