Welcome Guest, Not a member yet? Register   Sign In
how to load a model within a foreach
#1

[eluser]dcallan[/eluser]
$this->load->model('bll/Product_bll');

foreach ($query->result() as $row)
{
$basket_array[$count]['unitPrice'] = $row->unitPrice;
$basket_array[$count]['quantity'] = $row->quantity;
$basket_array[$count]['product'] = $this->Product_bll->getProduct($row->itemCode);

$count++;
}

return $basket_array;

What is the correct way to load a model within a foreach block. I'd normally load a model with $this-MODELNAME->MODELFUNCTION but from within the context of a foreach I think $this is taken to be the current looping row so my question is what way should I be looping a model within a foreach?

thanks in advance.


Messages In This Thread
how to load a model within a foreach - by El Forum - 02-10-2011, 03:59 AM
how to load a model within a foreach - by El Forum - 02-10-2011, 06:53 AM
how to load a model within a foreach - by El Forum - 02-10-2011, 07:44 AM
how to load a model within a foreach - by El Forum - 02-10-2011, 09:07 AM
how to load a model within a foreach - by El Forum - 02-10-2011, 09:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB