```
foreach ($topicarray as $key=>$value){
    $files = mysql_query("mysqlquery");

    while($file = mysql_fetch_array($files)){ extract($file);
        $topicarray[$value] = array( array($id=>$title)
                      );
       }
    }

```

The first foreach loop is providing me with an array of unique values which forms a 1-dimensional array.

The while loop is intended to store another array of values inside the 1-dimensional array.

When the while loop returns to the beginning, it is overwriting it. So I only ever get the last returned set of values in the array.

My array ends up being a two dimensional array with only one value in each of the inner arrays. 

Feels like I'm missing something very basic here - like a function or syntax which prevents the array from overwriting itself but instead, adds to the array.

Any ideas?