【发布时间】:2017-09-14 07:49:06
【问题描述】:
我连接到 sqlite db 并尝试从表中获取数据。
但它显示了一些错误,
致命错误:在第 300 行对 D:\xampp\htdocs\e-hadith\system\database\drivers\sqlite3\sqlite3_driver.php 中的非对象调用成员函数 lastErrorCode() 遇到 PHP 错误
严重性:错误
消息:在非对象上调用成员函数 lastErrorCode()
文件名:sqlite3/sqlite3_driver.php
行号:300
回溯:
下面是我的代码
{
$this->db->select("*");
$q=$this->db->get("chapter");
$r=$q->result();
echo "<pre>";print_r($r);exit;
$this->load->view('welcome_message');
}
$db['default'] = array(
'dsn' => '',
'hostname' => '',
'username' => '',
'password' => '',
'database' => 'sqlite:'.APPPATH.'/Database/data.db',
'dbdriver' => 'sqlite3',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
谁能推荐我?
【问题讨论】:
-
你加载数据库了吗?
-
我正在使用 db browser for sqlite @ManiKandan Kandan
-
我猜你需要提供数据库的主机名、用户名和密码
标签: php codeigniter sqlite