Quite simple, you have to make a loop running through the result set from your query, and copy it to an array..
for ( $i = 0; $i < odbc_num_rows($result); $i++ )
{
$array[$i] = odbc_result($result,$i);
}
I assume you are using ODBC to access the DB2 database ?