Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
What's wrong with this query in active record CodeIgniter 2?

I have some problem with active record in CodeIgniter 2.

SQL works perfectly:

SELECT c.title
     , c.post_status
     , d.data  
  FROM content c
  JOIN content_fields_data d
    ON c.id = d.item_id 
 WHERE c.full_tpl = 'page_doctor' 
   AND d.field_name = 'field_docid'

But when I'll try write this query in active record style, like this:

$this->db->select('c.title, c.post_status','cd.data', false);
$this->db->from('content as c');
$this->db->join('content_fields_data as cd', 'c.id = cd.item_id','left');
$this->db->where('c.full_tpl', 'page_doctor');
$this->db->where('cd.field_name', 'field_docid');

$allDatas = $this->db->get()->result_array();

I don't see in output cd.data.

What's I'm doing wrong?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

By accident you split your list of columns to two method's arguments, it should be one string

$this->db->select('c.title, c.post_status, cd.data', false);
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda