This is a quick and dirty way to accomplish the same thing:
<?
while(odbc_fetch_row($result)) {
$var1 = odbc_result($result, "NAMEOFFIELD1");
$var2 = odbc_result($result, "NAMEOFFIELD2");
..... //as many vars as you have fields with data to capture
$array_of_results[] = compact('var1', 'var2','var3', etc, etc)
}
?>
Just turn each returned row's data into variables then use the compact(). Turns each variable name into a key and the vars value into the array value. Makes a wonderful 2d array that you can walk easily and still use key values to get at data.