发生数据库错误codeigniter中的错误号:1046

发生数据库错误codeigniter中的错误号:1046,codeigniter,mysql-error-1046,Codeigniter,Mysql Error 1046,发生数据库错误 错误号码:1046 未选择任何数据库 从ts_主题中选择*其中theme_状态=1 文件名:C:/xampp/htdocs/Themeportal/application/models/DatabaseModel.php 行号:23在application/config/database.php $active_group = 'default'; $query_builder = TRUE; $db['default'] = array( 'dsn' => '

发生数据库错误

错误号码:1046

未选择任何数据库

ts_主题
中选择*其中
theme_状态
=1

文件名:C:/xampp/htdocs/Themeportal/application/models/DatabaseModel.php


行号:23

application/config/database.php

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
'dsn'      => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'database_name',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt'  => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
 );

首先配置数据库设置application/config/database.php

那么您的查询将被删除

    $this->db->select('*');
    $this->db->from('ts_themes');
    $this->db->where('theme_status',"1");
    $query=$this->db->get();
    return $query->result();

遇到PHP错误严重性:警告消息:mysqli::real_connect():(HY000/1049):未知数据库“”文件名:mysqli/mysqli_driver.php行号:202回溯:文件:C:\xampp\htdocs\Themeportal\application\controllers\Home.php行:8函数:u构造文件:C:\xampp\htdocs\Themeportal\index.php行:318函数:发生数据库错误后需要_无法使用提供的设置。文件名:C:/xampp/htdocs/Themeportal/application/controllers/Home.php行号:8设置如下
'database'=>'studentsnotes',
遇到php错误严重性:警告消息:file\u get\u contents(C:\xampp\htdocs\Themeportal\application\controllers应用程序/config/verify.txt):无法打开流:没有这样的文件或目录文件名:controllers/Default\u controllers.php行号:4回溯:文件:C:\xampp\htdocs\Themeportal\application\controllers\Default\u controllers.php行:4函数:file\u get\u目录文件:C:\xampp\htdocs\Themeportal\application\controllers\Home.php行:20函数:require文件:C:\xampp\htdocs\Themeportal\index.php行:318函数:require\u once是否可以发布应用程序\controllers\Home.php?检查一下
require\u once
中的错误。请提供有关您的环境或您正在尝试执行的操作的更多信息。遵循codeigniter
数据库\u model.php的类和文件命名方式类数据库模型扩展了CI模型{}