public function seek($row, $resource = '') {

        // if no active connection exists, return false
        if (!$this->_connected()) return false;

        // if no resource was specified, and there was a previous call to the "query" method, assign the last resource
        if ($resource == '' && isset($this->last_result) && $this->last_result !== false) $resource = & $this->last_result;

        // check if given resource is valid
        if ($this->_is_result($resource)) {

            // if this is an unbuffered query
            if ($resource->type == 1) {

                // get backtrace information
                $debug = debug_backtrace();

                // if method was called by another internal method (like fetch_assoc_all, for example) report that method
                if (isset($debug[1]) && isset($debug[1]['function']) && $debug[1]['class'] == 'Zebra_Database') $method = $debug[1]['function'];

                // if this (seek) method was called, report this method
                else $method = $debug[0]['function'];

                // save debug information
                return $this->_log('errors', array(

                    'message'   => sprintf($this->language['unusable_method_unbuffered_queries'], $method),

                ));

            }

            // return the fetched row
            if (mysqli_num_rows($resource) == 0 || mysqli_data_seek($resource, $row)) return true;

            // if error reporting was not suppressed with @
            elseif (error_reporting() != 0)

                // save debug information
                return $this->_log('errors', array(

                    'message'   => $this->language['could_not_seek'],

                ));

        // if $resource is actually a pointer to an array taken from cache
        } elseif (is_integer($resource) && isset($this->cached_results[$resource])) {

            // move the pointer to the start of the array
            reset($this->cached_results[$resource]);

            // if the pointer needs to be moved to the very first records then we don't need to do anything
            // as by resetting the array we already have that
            // simply return true
            if ($row == 0) return true;

            // if $row > 0
            elseif ($row > 0) {

                // get the current info from the array and advance the pointer
                while (next($this->cached_results[$resource]))

                    // if we've found what we were looking for
                    if ($row == key($this->cached_results[$resource])) return true;

                // save debug information
                return $this->_log('errors', array(

                    'message'   => $this->language['could_not_seek'],

                ));

            }

        }

        // if not a valid resource
        // save debug information
        return $this->_log('errors', array(

            'message'   => $this->language['not_a_valid_resource'],

        ));

    }
public function seek($row, $resource = '') {

        // if no active connection exists, return false
        if (!$this->_connected()) return false;

        // if no resource was specified, and there was a previous call to the "query" method, assign the last resource
        if ($resource == '' && isset($this->last_result) && $this->last_result !== false) $resource = & $this->last_result;

        // check if given resource is valid
        if ($this->_is_result($resource)) {

            // if this is an unbuffered query
            if ($resource->type == 1) {

                // get backtrace information
                $debug = debug_backtrace();

                // if method was called by another internal method (like fetch_assoc_all, for example) report that method
                if (isset($debug[1]) && isset($debug[1]['function']) && $debug[1]['class'] == 'Zebra_Database') $method = $debug[1]['function'];

                // if this (seek) method was called, report this method
                else $method = $debug[0]['function'];

                // save debug information
                return $this->_log('errors', array(

                    'message'   => sprintf($this->language['unusable_method_unbuffered_queries'], $method),

                ));

            }

            // return the fetched row
            if (mysqli_num_rows($resource) == 0 || mysqli_data_seek($resource, $row)) return true;

            // if error reporting was not suppressed with @
            elseif (error_reporting() != 0)

                // save debug information
                return $this->_log('errors', array(

                    'message'   => $this->language['could_not_seek'],

                ));

        // if $resource is actually a pointer to an array taken from cache
        } elseif (is_integer($resource) && isset($this->cached_results[$resource])) {

            // move the pointer to the start of the array
            reset($this->cached_results[$resource]);

            // if the pointer needs to be moved to the very first records then we don't need to do anything
            // as by resetting the array we already have that
            // simply return true
            if ($row == 0) return true;

            // if $row > 0
            elseif ($row > 0) {

                // get the current info from the array and advance the pointer
                while (next($this->cached_results[$resource]))

                    // if we've found what we were looking for
                    if ($row == key($this->cached_results[$resource])) return true;

                // save debug information
                return $this->_log('errors', array(

                    'message'   => $this->language['could_not_seek'],

                ));

            }

        }

        // if not a valid resource
        // save debug information
        return $this->_log('errors', array(

            'message'   => $this->language['not_a_valid_resource'],

        ));

    }
public function seek ( $ row , $ resource = '' ) { // if no active connection exists, return false if ( ! $ this -> _connected ( ) ) return false ; // if no resource was specified, and there was a previous call to the "query" method, assign the last resource if ( $ resource == '' && isset ( $ this -> last_result ) && $ this -> last_result !== false ) $ resource = & $ this -> last_result ; // check if given resource is valid if ( $ this -> _is_result ( $ resource ) ) { // if this is an unbuffered query if ( $ resource -> type == 1 ) { // get backtrace information $ debug = debug_backtrace ( ) ; // if method was called by another internal method (like fetch_assoc_all, for example) report that method if ( isset ( $ debug [ 1 ] ) && isset ( $ debug [ 1 ] [ 'function' ] ) && $ debug [ 1 ] [ 'class' ] == 'Zebra_Database' ) $ method = $ debug [ 1 ] [ 'function' ] ; // if this (seek) method was called, report this method else $ method = $ debug [ 0 ] [ 'function' ] ; // save debug information return $ this -> _log ( 'errors' , array ( 'message' => sprintf ( $ this -> language [ 'unusable_method_unbuffered_queries' ] , $ method ) , ) ) ; } // return the fetched row if ( mysqli_num_rows ( $ resource ) == 0 || mysqli_data_seek ( $ resource , $ row ) ) return true ; // if error reporting was not suppressed with @ elseif ( error_reporting ( ) != 0 ) // save debug information return $ this -> _log ( 'errors' , array ( 'message' => $ this -> language [ 'could_not_seek' ] , ) ) ; // if $resource is actually a pointer to an array taken from cache } elseif ( is_integer ( $ resource ) && isset ( $ this -> cached_results [ $ resource ] ) ) { // move the pointer to the start of the array reset ( $ this -> cached_results [ $ resource ] ) ; // if the pointer needs to be moved to the very first records then we don't need to do anything // as by resetting the array we already have that // simply return true if ( $ row == 0 ) return true ; // if $row > 0 elseif ( $ row > 0 ) { // get the current info from the array and advance the pointer while ( next ( $ this -> cached_results [ $ resource ] ) ) // if we've found what we were looking for if ( $ row == key ( $ this -> cached_results [ $ resource ] ) ) return true ; // save debug information return $ this -> _log ( 'errors' , array ( 'message' => $ this -> language [ 'could_not_seek' ] , ) ) ; } } // if not a valid resource // save debug information return $ this -> _log ( 'errors' , array ( 'message' => $ this -> language [ 'not_a_valid_resource' ] , ) ) ; }
Moves the internal row pointer of the MySQL result associated with the specified result identifier to the
specified row number.

The next call to a fetch method like {@link fetch_assoc()} or {@link fetch_obj()} would return that row.

@param  integer     $row        The row you want to move the pointer to.

<i>$row</i> starts at 0.

<i>$row</i> should be a value in the range from 0 to {@link returned_rows}

@param  resource    $resource   (Optional) Resource to fetch.

<i>If not specified, the resource returned by the last run query is used.</i>

@since  1.1.0

@return boolean                 Returns TRUE on success or FALSE on failure.
Moves the internal row pointer of the MySQL result associated with the specified result identifier to the specified row number .