odbc_field_type

string odbc_field_type(resource result, mixed field) 

Displays field datatype.

Returns:

Type of the specified field; FALSE on error

Description:

Returns the type of the field specified by a field number. The type is the field type specified when the database was created—long, text, and so on.

Version:

Existing since version 3.0.6

Example:

Display field type
$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 is type %s\n", odbc_field_name($result, $col), 
      odbc_field_type($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.