odbc_field_precision

int odbc_field_precision(resource result, int column) 

Displays field length.

Returns:

Field length; FALSE on error

Description:

Displays the length of the field specified by a field number. Field numbering starts at 1.

This function is an alias for odbc_field_len().

Version:

Existing since version 3.0.6

Example:

Display field lengths
$db = odbc_connect("DSN","user","pass"); 
$sql = "SELECT * FROM Products"; 
$result = odbc_exec($db, $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_precision($result, $col)); 
} 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.