当我选择链接时,代码点火器分页链接不起作用


codeigniter pagination link is not working when i select the link

请求yo帮助进行分页链接。在我的数据库中,我有3条记录,我想每页显示一条记录。当我选择分页链接的下一个数字时,数据不会被提取。问题是,当我点击分页链接的第2个时,echo var_dump()显示Result为空,并且我没有得到任何echo$data->email.但当我第一次搜索时,我能够显示单个记录,问题只是分页的下一个链接。那么错误可能是什么呢?我无法得到答案,也不确定会发生什么,所以我在下面发布了我的代码,请仔细阅读并帮助我。请求你帮助我。

**HERE STARTS MY CONTROLLER**
 public function users($limit=1,$offset = 0)
{
$this->load->helper('url');
$data = array();
$look = $this->input->post('look');
$age = $this->input->post('age');
$age_from = $this->input->post('age_from');
$age_to = $this->input->post('age_to');
$se_ct = $this->input->post('sect');
$subsect = $this->input->post('subsect');
$coun_try = $this->input->post('country');
$sta_te = $this->input->post('state');
$ci_ty = $this->input->post('city');
$qualification = $this->input->post('qualification');
$results = $this->searchresultss->login($look, $age, $age_to, $age_from, $se_ct, $subsect, $coun_try, $sta_te, $ci_ty, $qualification);
$this->load->helper('url');
$config = array();
$config['base_url'] = base_url().'searchresult/users';
$config['total_rows'] = count($results);
$config['per_page'] = $limit;
$this->load->library('pagination', $config);
$data['pagination_links'] = $this->pagination->create_links();
$data['results'] = array_slice($results, $offset, $limit);
 $this->load->view('searchresult', $data);
$this->load->view('includes/khelp');
$this->load->view('includes/kfooter');

**HERE STARTS MY MODEL PAGE**
     Class Searchresultss extends CI_Model
            {
            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 START MY VIEW PAGE**
echo var_dump($_POST);
if (empty($results)) {
 echo 'Results set is empty';
        } else 
        {
        foreach ($results as $data) {
                echo $data->email.'<br />';
            }
        }
        echo $pagination_links;

问题在于分页链接不包括POST变量(以及通过GET请求超链接)。我建议您在$_GET和$_POST上执行var_dump(),问题会变得更加明显。

一个可能的解决方案是将post变量作为url参数。例如

$config['base_url'] = base_url().'searchresult/users/look_param/age_param/etcetc';

但是,您需要添加功能来处理上述问题。