我正在使用 CRUD 教程来解决这个问题:
public function get($id = NULL, $single = FALSE){
if ($id != NULL) {
$filter = $this->_primary_filter;
$id = $filter($id);
$this->db->where($this->_primary_key, $id);
$method = 'row';
}
elseif($single == TRUE) {
$method = 'row';
}
else {
$method = 'result';
}
if (!count($this->db->ar_orderby)) {
$this->db->order_by($this->_order_by);
}
return $this->db->get($this->_table_name)->$method();
}
但我收到了这个错误信息:
A Database Error Occurred
Error Number: 1046
No database selected
SELECT * FROM (`pages`) WHERE `slug` = 'about' ORDER BY `order`
Filename: /var/application/core/MY_Model.php
Line Number: 34($this->db->get($this->_table_name)->$method();)
如何选择数据库?