Hi,
Just to be clear, a multidimensional array looks something like:
[PHP]$array = array(array(0, 1)); // 2 dimensional since you need two indexes to get the values eg: $array[0, 0];[/PHP]
I believe whats limiting the code right now is the notation of your arrays. (that may just be an example by the way, but anyways..) Since the arrays will be dynamic, you do not want to use a "static" notation such as:
[PHP]$array = array($item1, $item2);[/PHP]
In the above example:
This would assume that the array has a fixed length of 2 every time.
It also assumes that its an indexed array, with indexed 0 and 1.
IF you use something like:
[PHP]$array = array('item1'=>$item1, 'itme2'=>$item2);[/PHP]
Its even more static, since you're assuming the same for the first array, and also that the associative indexes have to be item1 and item2.
For dynamic arrays use the notation:
[PHP]$array = array(); // instantiate the array
$array[$index] = $value; // if you want to add a single dynamic index and value
// or as many as you need...[/PHP]
Since a database is dynamic, it will give you back a dynamic array. It does not need you to instantiate your arrays (like other programming languages). In php, $array[0] = 'soemthing'; inistantiates an array, and gives it the property 'something' with the index 0.
In short:
You do not need to define your arrays.
The database functions will return the arrays for you in the format you specify.
In fact (to my knowledge) mysql (and thus php) only returns 1 dimensional arrays, either associative or indexed numerically. (you can create multidimensional arrays out of this, but thats just complicating things).
(even using SELECT with JOIN or UNION will create new indexes on the same dimension of the 1-dimensional array)
see the mysql docs on PHP.net. http://us2.php.net/mysql
For returning numerically indexed arrays: http://us2.php.net/manual/en/function.mysql-fetch-row.php
Returning associative arrays: http://us2.php.net/manual/en/function.mysql-fetch-assoc.php
If you prefer objects: http://us2.php.net/manual/en/function.mysql-fetch-object.php
(returns the default php object (new stdClass());)
If you really need to create multidimensional arrays out of the returned results, you can use the array functions: http://us3.php.net/array
Hope that helps. I'm not sure I got the question fully though...