How to see in bootstrap datatable on next page a user name on top side. my Question is that when a user gives questions of answers in objective then its questions and answer list goes to on the next page at next page i want to see that user name continuously. My problem is coming that on next page user name showing even question and answers of that a user end on previously page. how to solve that problem when all questions and answers of user end on previously page should not show on next page of that user name.
<div id="user-answer-datatable-responsive3">
<table id="user-answer-datatable-responsive1" class="table table-striped table-bordered dt-responsive nowrap bulk_action" cellspacing="0" width="100%">
<thead>
<tr>
<th style="width: 40%;">Athlete Name/Questions</th>
<th>Users Answer</th>
</tr>
<!-- <tr>
<th style="width: 40%;">Athlete Name/Questions</th>
<th>Users Answer</th>
</tr>-->
</thead>
<tbody id="render-list-of-order1">
<?php $rows = 1; $i=1;?>
<?php foreach ($data['question'] as $key => $value) { ?>
<?php if($rows % 10 != 0){ ?>
<tr style="background-color:#f9f9f9">
<td colspan="2" ><b><?php echo $value['first_name'] . ' ' . $value['last_name']; ?></b></td>
<td class="hidden"></td>
</tr>
<?php }?>
<?php print_r($rows++); ?>
<?php foreach ($value['options_useranswer'] as $key => $values) { ?>
<tr style="background-color:white">
<td style=""><?php echo $values['questions']; ?></td>
<td style=""><?php echo $values['options_names']; ?></td>
</tr>
<?php if($rows % 10 == 0 ){
print_r(($rows).'df');?>
<tr style="background-color:#f9f9f9">
<td colspan="2" ><b><?php echo $value['first_name'] . ' ' . $value['last_name']; ?></b></td>
<td class="hidden"></td>
</tr>
<?php $rows++; } ?>
<?php print_r('('.($rows++).')');?>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
Php code:
public function answers() {
$response = $this->Godspeed->answersData($date = '1');
$data['data']['question'] = $response;
$this->load->template(array("Portal/User_answer" => ""), $data);
}
foreach ($data as $key => $value) {
$this->db->select('options.op_id,options.options_names,user_answers.q_id,question.questions,user_answers.date');
$this->db->from('user_answers');
$this->db->join('question', 'question.id = user_answers.q_id');
$this->db->join('options', 'options.op_id = user_answers.ans_respons','left');
$user_id = $value['user_id'];
$this->db->where("user_id = $user_id");
$this->db->where('user_answers.date BETWEEN "' . $date_current . $times[0] . '" and "' . $date_current . $times[1] . '"');
$query = $this->db->get();
foreach ($query->result_array() as $resultDatas) { //while loop can be possible
$data[$key]['options_useranswer'][] = $resultDatas;
}
}
return $data;
Database image showing:
Front page image showing: