我的控制器:笨:分页没有得到其他行
$config['base_url'] = base_url('admin/profile?id=' . $profile_id);
$config['total_rows'] = 1000;//count($data['getTime']);
$config['per_page'] = 5;
$config['num_links'] = 2;
//$config['uri_segment'] = 2;
//$config['enable_query_strings'] = TRUE;
$config['page_query_string'] = TRUE;
$config['use_page_numbers'] = TRUE;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$page = ($this->uri->segment(5))? $this->uri->segment(5) : 0;
$data['getTime'] = $this->admin->getUserProfileTime($profile_id, $config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
//pagination
我的模型
function getUserProfileTime($profile_id, $num, $page)
{
$this -> db -> select('*');
//$this -> db -> from('timerecord');
$this -> db -> where('id', $profile_id);
//-$this -> db -> order_by('dateToday', 'DESC');
$this -> db -> order_by('dateOrder', 'DESC');
$this -> db -> limit($num, $page);
$query = $this -> db -> get('timerecord');
//$array = $query->result_array();
return $query->result();
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
我的看法
<?php
foreach($getTime as $row):
$timeStat = $row->status;
$approveStat = $row->ApprovalStat;
?>
<tr>
<td class="tn-ixdt"><?php echo $row->year_Int ?></td>
<td class="tn-ixdt"><?php echo $row->dateToday ?></td>
<td class="tn-ixdt"><?php echo $row->day ?></td>
<td class="tn-ixdt" style="text-align:center;"><?php echo $row->day_Int ?></td>
<td class="tn-ixdt"><?php echo $row->timeIn ?></td>
<td class="tn-ixdt"><?php echo $row->timeOut ?></td>
<td class="tn-ixdt"><?php echo $row->status ?></td>
</tr>
<?php endforeach; ?>
</table><br />
<div align="center"><?php echo $links; ?></div>
您好,我的分页工作不正常,它显示第一个5正确的记录,但是当我点击分页链接它不会去其他行,这是问题是在我的网址查询?我的网址就像这个admin/profile?id = 1 & per_page = 65,页码也是正确的,但它仍然没有从我的表中获取其他记录。拜托,我需要你的帮助!谢谢!
尝试打印当您打开下一页时生成的原始查询,请参阅wht's wro那里 – ngakak 2014-09-02 08:44:52
你是什么意思原始查询建立?先生。 ngakak? – CyrussDev 2014-09-02 09:26:39
原始查询导致您的活动记录 – ngakak 2014-09-02 09:44:03