You have specified an invalid database connection group codeigniter error

蓝咒 提交于 2019-11-28 00:56:25

You are loading a database group called circrud. But there are no database group called that. The only one you have is a group called default which will be loaded by default if you don't specify a group.

$this->load->database('cicrud');

You should just do

$this->load->database(); in this part of the code:

class Users_model extends CI_Model {

function __construct()

{

parent::__construct();

$this->load->database();

}

You are already using database group "cicrud" in your database connection here:

$this->load->database('cicrud');

So you can change it to:

$this->load->database();

Or you can change your config to this:

$db['cicrud']['hostname'] = 'localhost';
$db['cicrud']['username'] = 'root';
$db['cicrud']['password'] = '';
$db['cicrud']['database'] = 'cicrud';
$db['cicrud']['dbdriver'] = 'mysql';
$db['cicrud']['dbprefix'] = '';
$db['cicrud']['pconnect'] = TRUE;
$db['cicrud']['db_debug'] = TRUE;
$db['cicrud']['cache_on'] = FALSE;
$db['cicrud']['cachedir'] = '';
$db['cicrud']['char_set'] = 'utf8';
$db['cicrud']['dbcollat'] = 'utf8_general_ci';
$db['cicrud']['swap_pre'] = '';
$db['cicrud']['autoinit'] = TRUE;
$db['cicrud']['stricton'] = FALSE;

See what is better for you.

$autoload['libraries'] = array('database','session');

add this in config/autoload.php then

$this->load->database('databasename');

add this in model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!