Welcome Guest, Not a member yet? Register   Sign In
A newbie already in trouble! - returning array data
#2

[eluser]Glen Swinfield[/eluser]
You are not actually returning anything from your model:

Code:
class Testmodel extends Model {
    
    function Testmodel()
    {
        
        parent::Model();  
    }
    
    function get_page_title()
    {
        $query = $this->db->query('SELECT page_info.page_title FROM page_info');

        $row = $query->row();

        // Need to return values
        return $row;
        
    }

}
}

Controller:

Code:
class Test_con extends Controller {
    
    function Test_con()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->model('Testmodel');
        //$data['page_title'] will now gat values of $row in model
        $data['page_title'] = $this->Testmodel->get_page_title();
        
        $this->load->view('selection', $data);
    
    }
}


Messages In This Thread
A newbie already in trouble! - returning array data - by El Forum - 07-16-2007, 03:46 AM
A newbie already in trouble! - returning array data - by El Forum - 07-16-2007, 04:49 AM
A newbie already in trouble! - returning array data - by El Forum - 07-16-2007, 04:52 AM
A newbie already in trouble! - returning array data - by El Forum - 07-16-2007, 04:54 AM
A newbie already in trouble! - returning array data - by El Forum - 07-16-2007, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB