- 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:connection:getrow

# getRow

##### syntax

     mixed getRow (
           mixed $sql
           optional string[] $bindvars
           )

## Description

The function executes a statement and returns the first row of the recordset in an array or false if the statement execution fails. If no records match the provided SQL statement, an empty array is returned.

The presentation of the returned data can be modified by the variables $ADODB_FETCH_MODE and $ADODB_ASSOC_CASE and the function setFetchMode().

For a detailed description of the SQL and bind parameters passed, see execute().

The statement is not the equivalent of `selectLimit($SQL,1)`. If multiple records are returned by the statement execution, all records after the first are destroyed. Reading large tables with a broad recordset selection may be slow,

### Usage

    /*
     * DB2 Connection assumed
    */
    $ar = $db->getRow("SELECT * FROM ACT");

    /*
     * $ar returns:
    Array
    (
        [0] => 10
        [1] => MANAGE
        [2] => MANAGE/ADVISE
    )

    */

[cache]
v5/reference/connection/getrow.txt · Last modified: 2016/01/16 15:51 by mnewnham

### Page Tools

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