【发布时间】:2014-09-15 06:16:01
【问题描述】:
我是 CI 新手,所以请大家帮我显示分页链接的结果。在数据库中,我有 3 条记录,每页显示一条记录。
当我选择下一个分页结果的数字链接时,问题出在我的分页链接中。
问题是,当我单击分页链接输出的第 2 号时,显示 $results 为空,并且我没有得到 echo $data->email 的任何值。
我也无法通过谷歌得到答案但是当页面加载的问题是当我选择下一个数字链接的分页链接时显示一条记录它不起作用。 分页脚本无法正常工作,我认为它与偏移量有关。
这是我的控制器。
public function login($look, $age, $age_to, $age_from, $se_ct, $subsect, $coun_try, $sta_te, $ci_ty, $qualification)
{
return $this->db->query("SELECT *FROM users WHERE gender = '$look' And status='1'")->result();
}
所以我不确定可能是什么错误,所以我在下面发布我的代码,请仔细阅读并帮助我。
**Here is my view page**
if (empty($results)) {
echo 'Results set is empty';
} else {
foreach ($results as $data) {
echo $data->email.'<br />';
}
}
echo $pagination_links;
//Error is when i select next numeric link of pagination record is not being fetched from database getting output as emty result in my view page.so request you to help me in solving the issue and more warning message is missiing argument 2 for Searchresult::users() , and more errror message is undefined variable offset .
【问题讨论】:
-
你必须通过所有参数进行分页
$config['base_url'],在加载页面时传递这些参数,也粘贴你的分页代码。 -
$config['base_url'] = base_url().'searchresult/users/$look/$age/$age_to/$age_from/$se_ct/$subsect/$coun_try/$sta_te/$ ci_ty/$qualification';
-
//您提交的 URI 包含不允许的字符。我得到的错误是什么
-
还需要设置offset和Limit,请检查codeigniter pagination,粘贴你的controller,model函数。
-
Reena 的问题仍然存在
标签: php codeigniter pagination