分页在我的Codeigniter中不起作用

时间:2014-01-09 11:27:12

标签: codeigniter

这是我的控制器文件,但它不起作用 控制器名称博客 型号名称blogmodel 查看文件名登录

function getvalues(){
    $config['base_url'] = 'http://192.168.1.50/codeigni/index.php/blog/getvalues';
$config['total_rows'] = 200;
$config['per_page'] = 20;

$this->pagination->initialize($config);

echo $this->pagination->create_links();
    $this->load->model('blogmodel');
    $data['results']=$this->blogmodel->getall();    
    $this->load->view('Login/loggedin',$data);      
    }
    }

这是我的模型文件和型号名称'blogmodel'

 function getall(){
    $query=$this->db->query("SELECT * FROM user_details");
   return $query->result();
                    }
}

这是我的查看文件,我无法访问分页

   <p><?php echo $links; ?></p><?php

    echo "<table border='1'>
    <tr>
    <th>id</th>
    <th>username</th>
    <th>password</th>
    <th>email</th>

    </tr>";
foreach($results as $row){
    echo "<tr>";
    echo "<td>" .$row->id;  
    echo "<td>". $row->username;
    echo "<td>". $row->password;
    echo "<td>". $row->email;
    echo "</tr>";
    }
    echo "</table>";
    ?>

1 个答案:

答案 0 :(得分:1)

而不是echo $this->pagination->create_links();

执行以下操作

$data["links"] = $this->pagination->create_links();