0

发生数据库错误

错误号:1046

未选择数据库

选择 * 从ts_themes哪里theme_status= 1

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

行号:23

4

2 回答 2

1

管理您的数据库设置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
 );
于 2017-02-04T15:56:39.600 回答
0

首先配置你的数据库设置 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();
于 2017-02-04T16:47:33.520 回答