[eluser]JoshK[/eluser]
I'm new to Code Igniter, and so far love it. However, I'm having issues when using multiple join statements in my functions.
Example: this code doesn't work.
Code:
function get_records()
{
$this->db->from('events');
$this->db->join('event_dates', 'event_dates.event_id = events.event_dates', 'LEFT');
$this->db->join('locations', 'locations.location_id = events.event_location', 'LEFT');
$this->db->join('users', 'users.user_id = events.event_creator', 'LEFT');
$this->db->join('categories', 'categories.category_id = events.event_category', 'LEFT');
$query = $this->db->get();
return $query->result();
}
however, if I only have 3 joins it works:
Code:
function get_records()
{
$this->db->from('events');
$this->db->join('locations', 'locations.location_id = events.event_location', 'LEFT');
$this->db->join('users', 'users.user_id = events.event_creator', 'LEFT');
$this->db->join('categories', 'categories.category_id = events.event_category', 'LEFT');
$query = $this->db->get();
return $query->result();
}
I'm lost, can anyone spot the error in the first chunk of code?
And it only worked with 3 joins once I added the 'LEFT' to each of the joins. I can't find any answers.
Thanks in advance guys.