ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


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:

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
)
 
*/
 
v5/reference/connection/getrow.txt · Last modified: 2019/05/08 16:41 by dregad