How to retrieve data from the database and display it in a html table using Codeigniter
03:06 01 Aug 2013

anyone please help me to retrieve the db data and how to view it in html table.is the coding i given is correct or not if not can you please say how i have to give. in order to view it in html table.

Controller

class edit_content extends CI_Controller {

    function edit_content()
    {
        parent::__construct();
        $this->load->model('editcontent_model');
        $this->load->helper('url');
        $this->load->library('acl');
        $this->data = $this->editcontent_model->get_contents();
    }
}

View

data  as $r): ?>
        
Content

Model

class editcontent_model extends CI_Model {
    var $CI; 

    function editcontent_model(){
        parent::__construct();
    }

    function get_contents() {
        $this->db->select('content');
        $this->db->from('contents');
        $query = $this->db->get();
        return $result = $query->result();
        $this->load->view('edit_content/edit_content', $result);
    }
}
php codeigniter model-view-controller html-table