I am here today to ask for help from those who are more experienced than I in the subject. I have a free query with codeigniter, which error in execution, but when I perform it in Workbenth goes right. I'll leave the code below and hope someone can help me.
protected $cms;
// Construção da classe pai
public function __construct(){
parent:: __construct();
$this->cms = $this->load->database('cms', TRUE);
}
// pega os atributos para exibir no carousel
function getCarousel(){
$this->cms->query('SELECT titulo.post_title, titulo.post_name, anexo.ID, anexo.guid
FROM
pt_posts anexo
inner join pt_posts titulo on titulo.ID = anexo.post_parent
WHERE
anexo.post_type = "attachment"
ORDER BY
ID
DESC LIMIT 4');
$query = $this->cms->get()->result();
if ($query) {
return $query;
}else{
return false;
}