Why does my data not pass into my view correctly?

Posted by dmanexe on Stack Overflow See other posts from Stack Overflow or by dmanexe
Published on 2010-03-30T17:46:02Z Indexed on 2010/03/30 17:53 UTC
Read the original article Hit count: 404

Filed under:
|
|
|
|

I have a model, view and controller not interacting correctly, and I do not know where the error lies.

First, the controller. According to the Code Igniter documentation, I'm passing variables correctly here.

function view() {
        $html_head = array( 'title' => 'Estimate Management' );

        $estimates = $this->Estimatemodel->get_estimates();

        $this->load->view('html_head', $html_head);
        $this->load->view('estimates/view', $estimates);
        $this->load->view('html_foot');
    }

The model (short and sweet):

function get_estimates() {
        $query = $this->db->get('estimates')->result();
        return $query;
    }

And finally the view, just to print the data for initial development purposes:

<? print_r($estimates); ?>

Now it's undefined when I navigate to this page. However, I know that $query is defined, because it works when I run the model code directly in the view.

© Stack Overflow or respective owner

Related posts about mvc

Related posts about php