English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The odbc_field_scale() function retrieves the number of decimal places of the field.
int odbc_field_scale( resource $result_id, int $field_number )
Get the number of decimal places of the field to get the number of decimal places of the floating-point number.
Returns the number of decimal places of the field as an integer, or 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 scale %s\n", odbc_field_name($result, $col), odbc_field_scale($result, $col)); } ?>