发生数据库错误
错误号:1046
未选择数据库
从ts_themes
中选择 *,其中 theme_status
= 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
);
首先配置数据库设置应用程序/配置/数据库.php
那么你的查询将是
$this->db->select('*');
$this->db->from('ts_themes');
$this->db->where('theme_status',"1");
$query=$this->db->get();
return $query->result();