Código PHP:
Ver original
$consulta = "SELECT * FROM (`mensaje`) WHERE `id_emisor` IN (1,2) AND `id_receptor` IN (1,2) AND `id_anuncio` = 3 "; $a = $this->db->get($consulta);
Pero me da este error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM (`mensaje`) WHERE `id_emisor` IN (1, `2` ) AND `id_receptor` IN (1, `2` ' at line 2
SELECT * FROM (`SELECT` * FROM (`mensaje`) WHERE `id_emisor` IN (1, `2` ) AND `id_receptor` IN (1, `2` ) AND `id_anuncio` = 3)
Lo correcto sería eso, pero tampoco funciona
Código PHP:
Ver original
$this->db->from('mensaje'); $this->db->where_in('id_emisor', "$id1, $id2"); $this->db->where_in('id_receptor', "$id1, $id2"); $this->db->where('id_anunci', $id_anuncio);
El problema es que son valores numéricos y codeigniter le pone unas comillas que sobran. Como las quito?