Here is the webpage that demonstrates my code problem: http://170.104.158.16/chemlatestPAGETEST.php3?pwsno=00100 I'm so close I can smell it. Hoping someone can troubleshoot my code. Here is the piece that doesn't work. It returns the 2 column names, over and over. For some reason I'm not loading the values from the query. (Using only 2 columns for now and hardcoding number of rows): function QueryIntoArray($query){ settype($retval,"array"); /* connect to sdwis server*/ $connectionSDWIS = odbc_connect("xxxx","xxxx","xxxx"); if(!$connectionSDWIS) die("Couldn't connect"); /* select sdwis database */ odbc_do($connectionSDWIS, "use xxxx"); $result= odbc_do($connectionSDWIS,$query); if(!$result){ print "Query Failed"; } for($i=0;$i<100;$i++){ $fields=odbc_num_fields($result); for($j=1;$j <$fields;$j++){ $retval[$i][odbc_field_name($result,$j)] = odbc_result($result,$j); }//end inner loop }//end outer loop return $retval; }//end function $query = "SELECT DISTINCT PWS, PWSName, CONVERT(varchar(12), DateCollected, 101), AnalyteName, SourceID, str(Results,7,4), str(MCL, 7,4), UOM, DateCollected FROM ChemMon WHERE PWSID='00100' AND AnalyteCode NOT IN('3013','3014','3100') ORDER BY DateCollected DESC, AnalyteName "; settype($myresult,"array"); $myresult = QueryIntoArray($query); for($i=0;$i<count($myresult);$i++){ print $myresult[$i]["AnalyteName"]; print $myresult[$i]["UOM"]; } --------------------------------- Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.