English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The odbc_field_len() function retrieves the length (precision) of the field
int odbc_field_len ( resource $result_id, int $field_number )
It is used to get the length of a field
Returns the field length, returns False if an error occurs.
Number | Parameters and Description |
---|---|
1 | result_id Result Identifier. |
2 | field_number Field Number. The field number starts from1Start. |
Try the following example
<?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)); } ?>