杂货CRUD始终显示没有要显示的项目,但显示总页数网格页脚

时间:2015-05-14 02:13:38

标签: php codeigniter grocery-crud

我遇到问题,我正在使用Grocery CRUD,当我列出数据时,它总是显示No items to display,但它会显示表格中的记录总数

控制器

class manage_home扩展了CI_Controller {

public function __construct() {
    parent::__construct();

    $this->load->database();
    $this->load->helper('url');

    $this->load->library('grocery_CRUD');
 }
    public function all_intro() {
   // echo "All is well";
    $crud = new grocery_CRUD();

    $crud->set_table('tbl_home_information');
    $crud->columns('pk_information_id','information_title','information_status','information_added');
    $crud->fields('pk_information_id','information_title','information_status','information_added');

    $crud->display_as('pk_information_id','ID');
    $crud->display_as('information_title','Title');
    $crud->display_as('information_added','Date');
    $crud->display_as('information_status','Status');

    $output = $crud->render();

    $this->_example_output($output, "Manage Brands");
}
}

enter image description here修改 我的方案是 enter image description here

1 个答案:

答案 0 :(得分:0)

确保$crud->columns('pk_information_id','information_title','information_status','information_added');是数据库表的字段名称。如果您的$crud->set_primary_key('pk_information_id','"your database table name here"');设置为主键,请尝试添加pk_information_id。并尝试将$this->_example_output($output, "Manage Brands");声明为$this->_example_output($output,'"your controller to view url"');

对不起语法,希望它可以帮到你。