我想在我的模型類中使用select查詢而沒有實例化Zend_Db :: factory(),因爲我在application.ini.My中給出了數據庫的所有參數,數據庫名是mst2。 我的模型類,如下所示:在Zend項目的任何地方使用select查詢
class Application_Model_EmpIdMapper extends Zend_Db_Table_Abstract
{
public function checkEmpid($empId)
{
$select=$this->select()
->from(array('tc' => 'tcs_contact'),array('tc.employee_id'));
$table_data=$this->fetchAll($select);
$table_data=$table_data->toArray();
foreach($table_data as $row)
{
// don check the condition before putting it into for each loop
if($row['employee_id'] == $empId)
{
return 'true';
}
else
{
return 'false';
}
}
}
}
但ruuning應用程序給出了錯誤作爲
SQLSTATE [42S02]:基表或視圖未找到:1146表 'mst2.application_model_empidmapper' 沒有按不存在。
如何解決此問題?
什麼是數據庫中的表名? – emaillenin