[eluser]rvillalon[/eluser]
How do I run a foreach loop to change the values of an array before I send it out to the view for displaying?
I pass an array to my viewer as follows:
$data['product_list'] = $this->products_model->get_products($data['user_id']);
$this->load->view('admin/products/index', $data);
Then I run a foreach loop.
However, I want to change the value of all the $data['product_list']['id'] before I send it off. How would I go about doing that?
I tried the following, but can't seem to get it to work:
foreach($data['product_list'] as $product) {
$product['id'] = 1;
}