错误的图像
上图包含运行项目时发生的错误。
正如建议的那样,我尝试包含以下代码:
$autoload['libraries'] = array('database');
但它没有大喊任何结果,事实上它显示了另一个错误
请遇到错误 您指定的数据库连接组无效。
,请给出一个解决方案。
应用建议的代码时发生的错误。
在控制器中添加构造函数,例如
class Landing extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->helper('form');
$this->load->helper('url');
$this->load->helper('html');
$this->load->database();
}
}
然后在我们的模型文件中尝试执行查询,例如
$this->db->select('*')->from('tablename');
$where = array('email' => $email);
$this->db->where($where);
$query = $this->db->get();
$resultId = $query->result_id;
$row_count = $resultId->num_rows;
希望它能帮助你。