Welcome Guest, Not a member yet? Register   Sign In
export model results to variables
#1

[eluser]nigelb[/eluser]
I have written the following piece of code to convert the results from a model (array) to php variables

Code:
$this->load->model('Home');
$home=$this->Home->getHome();

foreach ($home as $homearr) {
    extract($homearr);
}

$data["title"]=$title;
$data["content"]=$content;

$this->load->view('display/home', $data);

Is there a better way to do this as it seems a bit long winded to me


Messages In This Thread
export model results to variables - by El Forum - 01-19-2008, 01:31 AM
export model results to variables - by El Forum - 01-19-2008, 02:08 AM
export model results to variables - by El Forum - 01-19-2008, 05:25 AM
export model results to variables - by El Forum - 01-19-2008, 06:48 AM
export model results to variables - by El Forum - 01-19-2008, 07:19 AM
export model results to variables - by El Forum - 01-19-2008, 07:24 AM
export model results to variables - by El Forum - 01-19-2008, 07:35 AM
export model results to variables - by El Forum - 01-19-2008, 07:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB