Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!