buttons fixed, insert feature added
[openemr.git] / library / adodb / adodb-iterator.inc.php
blob8612ba2d5fc1664d06563fc80b72f4f734bd6dd2
1 <?php
3 /*
4 V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
5 Released under both BSD license and Lesser GPL library license.
6 Whenever there is any discrepancy between the two licenses,
7 the BSD license will take precedence.
9 Set tabs to 4.
11 PHP5 Iterator Class:
13 $rs = $db->Execute("select * from adoxyz");
14 foreach($rs as $k => $v) {
15 echo $k; print_r($v); echo "<br>";
19 class ADODB_Iterator implements Iterator {
21 private $rs;
23 function __construct($rs)
25 $this->rs = $rs;
27 function rewind()
29 $this->rs->MoveFirst();
31 function hasMore()
33 return !$this->rs->EOF;
35 function key()
37 return $this->rs->_currentRow;
39 function current()
41 return $this->rs->fields;
43 function next()
45 $this->rs->MoveNext();
47 function valid()
54 class ADODB_BASE_RS implements IteratorAggregate {
56 function getIterator() {
57 return new ADODB_Iterator($this);