[eluser]spmckee[/eluser]
I have spent the last hour pouring over posts related to the topic with nothing to show for it. Serious frustration.
I have three tables:
Code:
companies | projects | feeds
----------------------------------------------
id | id | id
company_name | company_id | project_id
company_status | project_name | feed_name
| project_status | feed_status
Here's my query:
Code:
function get_all()
{
$this->db
->join('projects', 'projects.id = feeds.project_id', 'left')
->join('companies', 'projects.company_id = companies.id', 'left')
->order_by('feeds.feed_name', 'DESC');
return parent::get_all();
}
And one of the Feed array results: (Main ID is incorrect)
Code:
[1] => stdClass Object
(
[id] => 32
[project_id] => 9
[feed_date_time] => 1313577000
[feed_status] => 1
[feed_name] => New Info
[feed_layout] => 2
[company_id] => 32
[project_name] => Red Team
[project_status] => 1
[company_name] => Acme
[company_status] => 1
)
I understand that the "ID" field is being overwritten by the last id retrieved. This causes my feed id to get lost. I also suspect that I need to use some kind of aliasing or something but not sure. Any help? I really want to understand this.
Thanks for your time!