->fetch() – fetch next row


boolean $DB_DataObject->fetch ( )


The fetch method gets the next row and sets the objects variables to the rows data. It returns TRUE if data has been collected, and FALSE when there is no more data.

Return value

boolean - TRUE on success and FALSE on failure.


This function can not be called statically.

Fetch is called by staticGet and get calls, so you can override this method in your classes, to add extra data to your object (like formated dates etc)


Simple find and fetch of data based on object Vars

= new DataObjects_Person;

$person->hair 'red';
$person->has_glasses 1;

$number_of_rows $person->find();

$people = array();
while (
$person->fetch()) {
/* store the results in an array */
$people[] = clone($person);
"GOT {$person->name}<BR>";

Overriding fetch to add extra data.

function fetch() {

$ret parent::fetch();
  if (
$ret === false) {
$this->dateFormated date('d/M/Y'$this->date);
find results (Previous) Perform a select count() request (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.