ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:getrandrow

getRandRow

syntax
 mixed getRandRow (
       mixed $sql
       optional string[] $bindvars=false
       )

Description

The function executes the function getArray() and returns a single random row from the returned recordset. See that function for more information about the passed parameters.

Usage

/*
 * DB2 Connection assumed
*/
$ar = $db->getRandRow("SELECT * FROM ACT");
 
/*
 * $ar returns:
Array
(
    [0] => 30
    [1] => DEFINE
    [2] => DEFINE SPECS
)
*/
 
/*
 * Execute again
 */
$ar = $db->getRandRow("SELECT * FROM ACT");
 
/*
 * $ar returns:
Array
(
    [0] => 100
    [1] => TEACH
    [2] => TEACH CLASSES
)
*/            
v5/reference/connection/getrandrow.txt · Last modified: 2016/01/16 23:49 by mnewnham