用ODBC从数据库中取出一行数据,以关联数组形式输出

public function get_all_fields($table,$key,$value){
    $sql = "select * from $table where $key='$value'";
    $rs = $this->_dql($sql);
    if (odbc_num_rows($rs) <> 0) {
        $data = array();
        while($row = odbc_fetch_array($rs)){
            foreach($row as $k=>$v){
                if(is_numeric($v)){
                    $data[$k] = $v;

// $data[] = $v;
}else{
$data[$k] = gb_to_utf($v);
// $data[] = gb_to_utf($v);
}
}
}
odbc_free_result($rs);
odbc_close_all();
return $data;
}else {
unset($rs);
odbc_close_all();
return false;
}
}

https://www.baidu.com/link?url=JgqNS-HmRclYgIdqZStu4c_nOxARj7ZRRk7S9-XUtDaM_2JCm3T_i7s1kfAFScXFCvAwvYGWokl-vLkJhMOsaq&wd=&eqid=86a6fe5b000d5ed40000000658b9924d