Location: PHPKode > scripts > Simple Object > simplemysqlresultiterator.php
<?php
	class SimpleMysqlResultIterator extends SimpleIterator {
		
		var $query_result;
		
		function SimpleMysqlResultIterator($query) {
			parent::SimpleIterator(SO_NOT_STRICT);
			$this->query_result = mysql_query($query);
		}
		
		function next() {
			$row = mysql_fetch_assoc($this->query_result);
			if ( is_array($row) ) {
				$this->import($row);
				return TRUE;
			} else {
				return FALSE;
			}
		}
		
		function reset() {
			mysql_data_seek($this->query_result,0);
		}
		
		function size() {
			return mysql_num_rows($this->query_result);
		}
	}
?>
Return current item: Simple Object