public function fetch_assoc_all($index = '', $resource = '') {

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

        // if only one argument was given
        // meaning that the first argument is either a valid resource or a pointer to an array taken from cache
        if ($resource == '' && $this->_is_result($index) || (is_integer($index) && isset($this->cached_results[$index]))) {

            // use the first argument as the actual resource
            $resource = $index;

            // consider first argument as skipped
            $index = '';

        }

        // if no resource was specified, and a query was run before, assign the last resource
        if ($resource == '' && isset($this->last_result) && $this->last_result !== false) $resource = & $this->last_result;

        if (

            // if $resource is a valid resource
            $this->_is_result($resource)

            // OR $resource is a pointer to an array taken from cache
            || (is_integer($resource) && isset($this->cached_results[$resource]))

        ) {

            // this is the array that will contain the results
            $result = array();

            // move the pointer to the start of $resource
            // if there are any rows available (notice the @)
            if (@$this->seek(0, $resource)) {

                // iterate through the records
                while ($row = $this->fetch_assoc($resource)) {

                    // if $index was specified and exists in the returned row, add data to the result
                    if (trim($index) != '' && isset($row[$index])) $result[$row[$index]] = $row;

                    // if $index was not specified or does not exists in the returned row, add data to the result
                    else $result[] = $row;

                }

            }

            // return the results
            return $result;

        }

        // if $resource is invalid
        // save debug information
        return $this->_log('errors', array(

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

        ));

    }
public function fetch_assoc_all($index = '', $resource = '') {

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

        // if only one argument was given
        // meaning that the first argument is either a valid resource or a pointer to an array taken from cache
        if ($resource == '' && $this->_is_result($index) || (is_integer($index) && isset($this->cached_results[$index]))) {

            // use the first argument as the actual resource
            $resource = $index;

            // consider first argument as skipped
            $index = '';

        }

        // if no resource was specified, and a query was run before, assign the last resource
        if ($resource == '' && isset($this->last_result) && $this->last_result !== false) $resource = & $this->last_result;

        if (

            // if $resource is a valid resource
            $this->_is_result($resource)

            // OR $resource is a pointer to an array taken from cache
            || (is_integer($resource) && isset($this->cached_results[$resource]))

        ) {

            // this is the array that will contain the results
            $result = array();

            // move the pointer to the start of $resource
            // if there are any rows available (notice the @)
            if (@$this->seek(0, $resource)) {

                // iterate through the records
                while ($row = $this->fetch_assoc($resource)) {

                    // if $index was specified and exists in the returned row, add data to the result
                    if (trim($index) != '' && isset($row[$index])) $result[$row[$index]] = $row;

                    // if $index was not specified or does not exists in the returned row, add data to the result
                    else $result[] = $row;

                }

            }

            // return the results
            return $result;

        }

        // if $resource is invalid
        // save debug information
        return $this->_log('errors', array(

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

        ));

    }
public function fetch_assoc_all ( $ index = '' , $ resource = '' ) { // if no active connection exists, return false if ( ! $ this -> _connected ( ) ) return false ; // if only one argument was given // meaning that the first argument is either a valid resource or a pointer to an array taken from cache if ( $ resource == '' && $ this -> _is_result ( $ index ) || ( is_integer ( $ index ) && isset ( $ this -> cached_results [ $ index ] ) ) ) { // use the first argument as the actual resource $ resource = $ index ; // consider first argument as skipped $ index = '' ; } // if no resource was specified, and a query was run before, assign the last resource if ( $ resource == '' && isset ( $ this -> last_result ) && $ this -> last_result !== false ) $ resource = & $ this -> last_result ; if ( // if $resource is a valid resource $ this -> _is_result ( $ resource ) // OR $resource is a pointer to an array taken from cache || ( is_integer ( $ resource ) && isset ( $ this -> cached_results [ $ resource ] ) ) ) { // this is the array that will contain the results $ result = array ( ) ; // move the pointer to the start of $resource // if there are any rows available (notice the @) if ( @ $ this -> seek ( 0 , $ resource ) ) { // iterate through the records while ( $ row = $ this -> fetch_assoc ( $ resource ) ) { // if $index was specified and exists in the returned row, add data to the result if ( trim ( $ index ) != '' && isset ( $ row [ $ index ] ) ) $ result [ $ row [ $ index ] ] = $ row ; // if $index was not specified or does not exists in the returned row, add data to the result else $ result [ ] = $ row ; } } // return the results return $ result ; } // if $resource is invalid // save debug information return $ this -> _log ( 'errors' , array ( 'message' => $ this -> language [ 'not_a_valid_resource' ] , ) ) ; }
Returns an associative array containing all the rows from the resource created by the previous query or from the
resource given as argument and moves the internal pointer to the end.

<code>
// run a query
$db->query('SELECT * FROM table WHERE criteria = ?', array($criteria));

// fetch all the rows as an associative array
$records = $db->fetch_assoc_all();
</code>

@param  string      $index      (Optional) Name of a column containing unique values.

If specified, the returned associative array's keys will be the values from this
column.

<i>If not specified, returned array will have numerical indexes, starting from 0.</i>

@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.2

@return mixed                   Returns an associative array containing all the rows from the resource created
by the previous query or from the resource given as argument and moves the
internal pointer to the end. Returns FALSE on error.
Returns an associative array containing all the rows from the resource created by the previous query or from the resource given as argument and moves the internal pointer to the end .