====== getRow ======
~~NOTOC~~
== 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:
* [[v5:reference:adodb_fetch_mode|$ADODB_FETCH_MODE]] variable,
* [[v5:reference:adodb_assoc_case|ADODB_ASSOC_CASE]] constant,
* [[v5:reference:connection:setfetchmode|setFetchMode()]] function.
For a detailed description of the SQL and bind parameters passed, see [[v5:reference:connection:execute|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
)
*/
{{tag>[cache]}}