Login   Register  
PHP Classes
elePHPant
Icontem

File: simplemysqlresultiterator.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of J.B.  >  Simple Object  >  simplemysqlresultiterator.php  >  Download  
File: simplemysqlresultiterator.php
Role: Auxiliary script
Content type: text/plain
Description: class SimpleMysqlResulterator extends SimpleIterator
Class: Simple Object
Base class with common variable access functions
Author: By
Last change:
Date: 10 years ago
Size: 589 bytes
 

Contents

Class file image Download
<?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);
        }
    }
?>