當我嘗試使用我的某個模型時,出現此錯誤「致命錯誤:調用未定義方法CI_DB_mysql_driver :: findVenueInfo()」。Codeigniter - 調用未定義的方法CI_DB_mysql_driver ::
我有此錨的圖:
echo anchor('welcome/searchVenue/' . $row->venue_id, $row->venue);
產生像一個鏈接:http://localhost/ci-llmg/index.php/welcome/searchVenue/1
調用的方法是
function searchVenue()
{
$this->load->model('venues');
//get venue info
$data['info'] = $this->venues->findVenueInfo($this->uri->segment(3)); //this line generates the error
}
和在模型中findVenueInfo功能(場地.php)是:
function findVenueInfo($id)
{
$data = array();
$this->db->where('id', $id);
$Q = $this->db->get('venues');
if ($Q->num_rows() > 0)
{
foreach ($Q->result() as $row)
{
$data[] = $row;
}
}
$Q->free_result();
return $data;
}
..但是這樣做的結果是致命錯誤:調用未定義的方法CI_DB_mysql_driver :: findVenueInfo() 我可能錯過了一些愚蠢的東西,但無法讓它工作!你怎麼看?
固定 - 我知道這是愚蠢的東西:) 的控制器使用$ this-> db-> findVenueInfo而不是$ this-> venue-> findVenueInfo。 – Patrick 2010-04-02 15:38:31