[英]Codeigniter cannot get data from mysql table
尝试从数据库中获取数据时出现以下错误:
错误号:1066
不是唯一的表格/别名:“常见问题解答”
SELECT * FROM( faq
, faq
)其中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;
}
}
在查询表中,该名称被调用了两次。 这是不必要的。 只需替换$ 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;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.