Welcome Guest, Not a member yet? Register   Sign In
How to access passed database resultset in my view?
#1

[eluser]Unknown[/eluser]
Hello everyone,

Ive been scrathing my head for a while now and cant get it to work.

I want to get a SELECT resultset passed to my view and display each row in a table.

My code looks like this:

Model function:

Code:
function get_all()
{
     $resultset = $this->db->query('SELECT * FROM venues');
        
     return $resultset;
}

Controller function:

Code:
function index()
    {
        if($this->session->userdata('logged_in') == TRUE)
        {
            $resultset = $this->_get_all();
            $this->load->view('venuesview', $resultset);
            
        else
        {
            redirect('login');
        }
    }
    
    function _get_all()
    {
        $this->load->model('m_venues');
        $resultset = $this->m_venues->get_all();
        
        return $resultset;
    }

so what do i do when i get to the view to access each rows data? i can get a simple array of strings to display in my view, but the resultset contains an array of arrays?

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB