$cnx= odbc_connect(dsn_name,"",""); if( ! $cnx ) { //call error handler //exit } //query column names without content //note, in my experience, odbc_columns doesn't work $query = 'select * from arcust01 where 1=2'; $cols = odbc_exec($this->cnx,$query); //getting number of columns $ncols = odbc_num_fields($cols); for ($n=1; $n<=$ncols; $n++) { $field_name = odbc_field_name($cols, $n); //display fields and types echo $field_name." ". odbc_field_type($cols, $n)."
"; }