You have to move the output of the table cells into the
foreach
loop and print them there using
echo
.
Something like (untested):
<table class="table"><thead><tr>
<th>#</th><th>Course</th><th>Name</th><th>Surname</th><th>Gender</th><th>City</th><th>Birth Date</th>
</tr></thead><tbody>
<?php foreach ( $records as $row ):?>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['sname'];?></td>
<!--
</tr>
<?php endforeach;?>
</tbody></table>
See also
Views — CodeIgniter 3.1.8 documentation[
^].