尝试从我的数据库中获取数据时出现以下错误:
错误号码:1066
不唯一的表/别名:'faq'
SELECT * FROM(faq
,faq
)WHERE faq_title
='title 1'
请帮我找出错误。这是我的模特:
public function did_get_faq_data($title){
$this->db->select('*');
$this->db->from('faq');
$this->db->where('faq_title', $title);
$query = $this->db->get('faq');
if ($query->num_rows() > 0){
return $query->result();
}
else {
return false;
}
}
答案 0 :(得分:1)
在您的查询表中,名称被调用两次。这是不必要的。 只需替换$ query = $ this-> db-> get('faq');到 $ query = $ this-> db-> get(); 大胆的是正确的。
公共职能did_get_faq_data($ title){
$this->db->select('*');
$this->db->from('faq');
$this->db->where('faq_title', $title);
$query = $this->db->get();
if ($query->num_rows() > 0){
return $query->result();
}
else {
return false;
}
}