Welcome Guest, Not a member yet? Register   Sign In
CI 1.6.3 issues with DBUtil
#1

[eluser]jtkendall[/eluser]
Hi, I'm trying to load the DBUtil class so that I can export a CSV of a DB query, however when I load the class in my controller I get an error stating:

Quote:Fatal error: Call to undefined method Export::_ci_assign_to_models() in /Library/WebServer/__Frameworks/CodeIgniter/1.6.3/system/libraries/Loader.php on line 276

I get the error regardless of where I try to load the DBUtil class.

My Controller:

Code:
<?php

    class Export extends Controller
    {

        public function __construct()
        {    
            parent::__construct();
            $this->load->dbutil();
        }

        public function index()
        {
            redirect('/ecommerce/reports/');
        }

        public function report($type=NULL, $id=NULL)
        {    
            if($type == null)
                $this->index();

            if($type == 'full')
            {
                $query = $this->crud_model->read('orders', array(), NULL);

                $delimiter    = ",";
                $newline    = "\r\n";
                echo $this->dbutil->csv_from_result($query);
            }
        }

    }

The line the error refers to in the Loader class is:

Code:
$CI->load->_ci_assign_to_models();

The full function where the error occurs:

Code:
/**
     * Load the Database Forge Class
     *
     * @access    public
     * @return    string        
     */        
    function dbforge()
    {
        if ( ! class_exists('CI_DB'))
        {
            $this->database();
        }
        
        $CI =& get_instance();
    
        require_once(BASEPATH.'database/DB_forge'.EXT);
        require_once(BASEPATH.'database/drivers/'.$CI->db->dbdriver.'/'.$CI->db->dbdriver.'_forge'.EXT);
        $class = 'CI_DB_'.$CI->db->dbdriver.'_forge';

        $CI->dbforge = new $class();
        
        $CI->load->_ci_assign_to_models();
    }

Any help would be appreciated. Thanks.


EDIT: I just switched my app to point to my 1.7.0 setup and same error, just a different line (looks like a few lines were added before the function in the file) 283


Messages In This Thread
CI 1.6.3 issues with DBUtil - by El Forum - 02-03-2009, 03:42 PM
CI 1.6.3 issues with DBUtil - by El Forum - 02-03-2009, 03:58 PM
CI 1.6.3 issues with DBUtil - by El Forum - 02-04-2009, 08:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB