- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:reference:recordset:fetchfield

# fetchField

##### Syntax

      obj fetchField() {
          optional integer $fieldNumber
      }

## Description

fetchField() returns database specific information about nth column in a row of a recordset. Column offsets start at zero. If no field number is provided, the first column is returned.

It is important to note that the information contained in the object returned varies from database to database. There is a common set of fields returned, but the values vary from database to database for the same data type. Check the guide for each driver to see any extra information provided.

## Usage

    /*
     * Using IBM DB2 driver
     */
    $SQL = "SELECT * FROM act";
    $f = $conn->Execute($SQL);
    /*
     * Offset 1
     */
    $fld = $f->FetchField(1);
    print_r($fld);
    /*
     * Returns the following information
     *ADOFieldObject Object
     (
        [name] => ACTKWD
        [max_length] => 6
        [type] => string
     )

## Explanation Of Common Fields

There are 3 common columns provided

Name | Description | Note
--- | --- | ---
NAME | The column name | Casing of the column name is controlled by the adodb_assoc_case constant.
MAX_LENGTH | The length of the field. | For CHAR type variables, this can represent the maximum character length, but for others, it can represent the number of bytes
TYPE | This is the database specific field type. | If you are writing cross-database applications, do not rely on this value. Instead, send the value to the metaType() method, to obtain a cross-platform identifier

v5/reference/recordset/fetchfield.txt · Last modified: 2016/01/16 15:40 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top