ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:getrandrow

This is an old revision of the document!


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.1452648658.txt.gz · Last modified: 2017/04/21 11:34 (external edit)