statement = $statement; // Since no more than one PDOStatement for any one connection can be safely // traversed, each statement simply requests all rows at once for safety. // This could be re-engineered to call fetchAll on an as-needed basis $this->results = $statement->fetchAll(PDO::FETCH_ASSOC); $statement->closeCursor(); } public function seek($row) { $this->rowNum = $row - 1; return $this->nextRecord(); } public function numRecords() { return count($this->results); } public function nextRecord() { $index = $this->rowNum + 1; if (isset($this->results[$index])) { return $this->results[$index]; } else { return false; } } }