[eluser]Zac G.[/eluser]
Hi, I am trying to do a join statement using CI's active record and I want to get the id column of the original table I'm querying, but it keeps giving me the second table's id instead.
Here is my code:
Code:
$this->db->where('courses.id', $course_id);
$this->db->join('course_programs', 'courses.id = course_programs.course_id');
$this->db->join('course_start_terms', 'courses.id = course_start_terms.course_id');
$query = $this->db->get('courses');
foreach ($query->result() as $row):
$course['id'] = $row->id;
$course['code'] = $row->code;
//More code...
endforeach;
Any suggestions on how I would get the courses.id?
Thanks!