未为配置的数据库启用查询构建器 [英] Query Builder not enabled for the configured database

查看:53
本文介绍了未为配置的数据库启用查询构建器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Ci版本3.0.4。 我试图修复这个错误,但没有找到解决方案,所以我在这里发帖 请帮帮忙。 我的配置、常量或控制器文件是否有任何错误? 我的配置文件、常量文件或控制器文件是否有错误。

**Error:** 

An uncaught Exception was encountered

Type: Exception

Message: Query Builder not enabled for the configured database. Aborting.

Filename: G:xamppsoftwarehtdocs24mehtasystemlibrariesSessiondriversSession_database_driver.php

Line Number: 90

**Adminx controller:**

class Adminx extends CI_Controller {

    function __construct() {
        parent::__construct();

        $this->load->module('login');

        $this->load->helper('form');
        $this->output->enable_profiler(ENABLE_PROFILER);
        $this->load->model('Page_DB_Interaction', 'page_db_interaction');
        $login = new Login();
        if (!$login->_is_logged_in()) {
            $citer = &get_instance();
            $url_page = $citer->uri->segment(1);
            $this->session->set_userdata('url_page', $url_page);
            $this->session->set_userdata('login_page', 'backend');
            redirect('login');
        }
    }

**Autoload file:**
$autoload['libraries'] = array('database');
$autoload['drivers'] = array('session');

**login controller**

class Login extends CI_Controller {

    function __construct() {

        parent::__construct();

        $this->load->helper('directory');
        $this->load->helper('cookie');
        $this->load->model('Global_model', 'gm');


    }

**config file:**
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'easfsession';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'NULL';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I am using ci version '3.0.4'

推荐答案

检查文件/application/config/database.php并确保$query_builder = TRUE;我猜它当前设置为False。

我还建议将session作为库而不是驱动程序加载。

$autoload['libraries'] = array('database', 'session');
//remove this line
//$autoload['drivers'] = array('session'); 

在会话配置中使用

$config['sess_save_path'] = 'ci_sessions'; //assumes `ci_sessions` is the table name you are using

这篇关于未为配置的数据库启用查询构建器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆