I am using codeigniter. I pass the data retrieved from the database to my view. The table should display 5 lists, each column should contain a list of names generated by the foreach loop in the view. Below is my view code.
<table class="table table-hover" >
<thead>
<tr>
<th scope="col" width="20%">Cameramen</th>
<th scope="col" width="30%">Camera Assistants</th>
<th scope="col" width="12%">Technical Assistants</th>
<th scope="col" width="20%">Setup Engineer</th>
<th scope="col" width="30%">Audio Operator</th>
<th scope="col" width="12%">Vision Operator</th>
</tr>
</thead>
<tbody>
<tr>
<?php
$index = 0;
foreach($c_list as $n_key){?>
<td><?php echo $index+1; ?>
<?php echo $n_key->name; ?><br/><br/>
<?php
$index++;
}?>
</td>
<?php
$index = 0;
foreach($ca_list as $n_key){?>
<td><?php echo $index+1; ?>
<?php echo $n_key->name; ?><br/><br/>
<?php
$index++;
}?>
</td>
<?php
$index = 0;
foreach($ta_list as $n_key){?>
<td><?php echo $index+1; ?>
<?php echo $n_key->name; ?><br/><br/>
<?php
$index++;
}?>
</td>
<?php
$index = 0;
foreach($se_list as $n_key){?>
<td><?php echo $index+1; ?>
<?php echo $n_key->name; ?><br/><br/>
<?php
$index++;
}?>
</td>
<?php
$index = 0;
foreach($ao_list as $n_key){?>
<td><?php echo $index+1; ?>
<?php echo $n_key->name; ?><br/><br/>
<?php
$index++;
}?>
</td>
<?php
$index = 0;
foreach($vo_list as $n_key){?>
<td><?php echo $index+1; ?>
<?php echo $n_key->name; ?><br/><br/>
<?php
$index++;
}?>
</td>
</tr>
</tbody>
</table>
But this gives the following result.

I want to display names row by row in each column. Can someone show me the error?
To get data from the database, I wrote 6 functions in my model. They are almost the same. Here I add one model function.
public function get_c_names($c)
{
$cdata = array();
foreach($c as $row) {
$cdata[] = $row->employee_id;
}
$this->db->select('employee.name');
$this->db->from('employee');
$this->db->where('employee.id IN ('.implode(", ",$cdata).')');
$query=$this->db->get();
return $query->result();
}
In the controller, I call this function with the following code, and then passed for viewing as follows. All 6 functions have the same template. Therefore, I publish only 1 of them.
$name['c_list'] = $this->employee_model->get_c_names($c);
$this->load->view('team_view',$name);