
odbc_field_len()函数获取字段的长度(精度)
语法
int odbc_field_len ( resource $result_id , int $field_number )
定义和用法
它用来获取一个字段的长度
返回值
返回字段长度,如果出错,则返回False。
参数
| 序号 | 参数和说明 | 
|---|---|
| 1 | result_id 结果标识符。 | 
| 2 | field_number 字段编号。 字段编号从1开始。 | 
实例
试试下面的实例
<?php
   $input_ID = odbc_connect("DSN","user_id","pass_id");
   $sql = "SELECT * FROM Products";
   $result = odbc_exec($input_ID, $sql);
   
   odbc_fetch_row($result);
   
   for ($col = 1; $col<=odbc_num_fields($result); $col++) {
      printf("Column %s has length %s\n", odbc_field_name($result, $col), odbc_field_len($result, $col));
   }
?>