ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v6:reference:connection:getrow

getRow

syntax
 array|null getRow (
       mixed $sql
       optional string[] $bindvars
       optional string[] $cacheOptions
       ) 
       

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:

For a detailed description of the SQL and bind parameters passed, see execute(). The statement also supports use of the Memcache service

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
)
 
*/
 
v6/reference/connection/getrow.txt · Last modified: by 127.0.0.1