To start, I went through many other stack overflow posts about similar things but they never worked for me.

I'm using code igniter in one of my pages, I need to use an array sent from my controller to my page within a function

```
function brandnames(){
foreach ($database as $value) {
    $Brand = $value['Brand'];
}

```

The error is saying the $database array is undeclared despite sending the info from the controller. 

```
$data["database"] = $this->Get_model->brandnames();

$this->view("update", $data);

```

When use the same forloop outside of the function it works but the issue is I need it in the function or ill have 400+ lines of extra code using if statements.