Welcome Guest, Not a member yet? Register   Sign In
returning one array from model to view
#1

[eluser]new_igniter[/eluser]
Hello,
I am very new to CI and having some beginner questions.

What I want to do is qun a query from a model, get an array of 1 row of data(something like title, contents, author,) return that array to my controller, pass the array into my view, where I can then echo the variables out.

My Model
Code:
function getPostContents($postUriID)
{  
$query = $this->db->query("my query");

        if(empty($query))
            return false;

        $row = $query->row();
        ?? what do I return here?
}


My Controller
Code:
$data['postContents'] = $this->Postsmodel->getPostContents($postUriID);
?? is this right?

My View
?? How do I then just do something like <?php echo $row->title; ?>

Thanks so much


Messages In This Thread
returning one array from model to view - by El Forum - 01-04-2008, 02:01 PM
returning one array from model to view - by El Forum - 01-04-2008, 03:37 PM
returning one array from model to view - by El Forum - 01-04-2008, 03:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB