• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI 1.6.3 issues with DBUtil

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:


    class Export extends Controller

        public function __construct()

        public function index()

        public function report($type=NULL, $id=NULL)
            if($type == null)

            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:


The full function where the error occurs:

     * Load the Database Forge Class
     * @access    public
     * @return    string        
    function dbforge()
        if ( ! class_exists('CI_DB'))
        $CI =& get_instance();
        $class = 'CI_DB_'.$CI->db->dbdriver.'_forge';

        $CI->dbforge = new $class();

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

Ok, just tried it on a completely different app and it works using both the 1.7.0 and 1.6.3 system folders. The only thing different on the app it won't work on is that it's using HMVC (ME) and there is a Controller.php file with that in the Application/libraries/ folder.

Solved this, with HMVC (ME)version 4.2.06 I had to rename Controller.php in the application/libraries folder to MY_Controller.php (duh) and then have all of my controllers extend it instead of Controller, except the one controller that has the DBUtil calls. It still extends Controller.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.