Reputation: 360
I get following error while trying to get data from my database:
Error Number: 1066
Not unique table/alias: 'faq'
SELECT *FROM (faq
, faq
)WHERE faq_title
= 'title 1'
Please help me to find my mistake. Here is my model:
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;
}
}
Upvotes: 0
Views: 539
Reputation: 1554
In your query table name is called two times. This is unnecessary. Just replace $query = $this->db->get('faq'); to $query = $this->db->get(); the bold one is correct.
public function 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;
}
}
Upvotes: 1