ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:activerecord:getactiverecords

This is an old revision of the document!


getActiveRecords

Syntax
bool getActiveRecords(
  string $tableName,
  optional string  $where=false,
  optional mixed[] $bindarr=false,
  optional mixed[] $primaryKeyArray=false
)

Description

This method retrieves an array of ADOdb_Active_Records.

Parameters

$tableName

Table used by the active record object

$where

Where clause

$bindarr

For more information on the use of Bind variables, see execute().

$primaryKeyArray

Usage

include 'adodb/adodb.inc.php';
include 'adodb/adodb-activerecord.inc.php';
 
$db = NewADOConnection('mysqli');
$db->connect('','user','password','employees');
 
$table        = 'departments';
$whereOrderBy = "name LIKE 'A%' ORDER BY Name";
$primaryKeys  = array('id');
$activeRecArr = $db->GetActiveRecords($table, $whereOrderBy,$primaryKeys);
foreach($activeRecArr as $rec) 
{
    $rec->id = rand();
    $rec->save();
}           
v5/activerecord/getactiverecords.1449331770.txt.gz · Last modified: 2017/04/21 11:21 (external edit)