I\'m developing a php app that uses a database class to query mySQL.
the class is here: http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/
Ideally a multidimensional array is usually an array of arrays so i figured declare an empty array, then create key and value pairs from the db result in a separate array, finally push each array created on iteration into the outer array. you can return the outer array in case this is a separate function call. Hope that helps
$response = array();
foreach ($res as $result) {
$elements = array("firstname" => $result[0], "subject_name" => $result[1]);
array_push($response, $elements);
}