Welcome Guest, Not a member yet? Register   Sign In
Foreach loop in controller
#2

[eluser]Dam1an[/eluser]
The way you're trying ti isn't working because $product isn't actually the item in the array
You could try doing as &$product which should do it by reference (I've never tried this, but read it works)
or the way I do it is
Code:
foreach($data['product_list'] as $key=>$product) {
  $data['product_list'][$key]['id'] = // Do what you want here
}

(Also, just a personal preference, but I would do the manipulation and then add the processed array to $data, but that might just be me)


Messages In This Thread
Foreach loop in controller - by El Forum - 09-01-2009, 11:33 AM
Foreach loop in controller - by El Forum - 09-01-2009, 11:40 AM
Foreach loop in controller - by El Forum - 09-01-2009, 11:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB