【发布时间】:2010-04-02 14:26:11
【问题描述】:
当我尝试使用我的模型之一时,我收到此错误“致命错误:调用未定义的方法 CI_DB_mysql_driver::findVenueInfo()”。
我对这个锚有看法:
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
}
模型(venues.php)中的findVenueInfo函数为:
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。
标签: codeigniter