Welcome Guest, Not a member yet? Register   Sign In
Data not transfering to page view
#1

[eluser]gazza7364[/eluser]
Hi

I'm new to CI and i've been testing to see how you pass code from model, controller and view.

I have the following code which should pass $data array to blog.php.

But when i pull up the page in a web browser I get the following message;-

Message: Undefined variable: result Filename: views/blog.phpLine Number: 9

I have echoed the $data from the controller and the result is array. But the array does not pass to the blog.php

Code:
<?php

class Blog_controller extends CI_Controller {

    function index()
    {
        $this->load->model('Blogmodel');

        $data['query'] = $this->Blogmodel->get_last_ten_entries();


        $this->load->view('blog', $data);

}
}

Thanks any help would be grateful.




Theme © iAndrew 2016 - Forum software by © MyBB