Můžete to zkusit změnit
<th>
<?php
foreach($columns as $column)
{ ?>
<td><?php echo $column; ?> </td>
<?php
}
?>
</th>
do
<tr>
<?php
foreach($columns as $column)
{ ?>
<th><?php echo $column; ?> </th>
<?php
}
?>
</tr>