I'm using MySQL ActiveRecord with CodeIgniter to submit queries, but have run into some snags when using the "select" function. For instance, this MySQL query works perfectly within phpMyAdmin:
SELECT review_id, firms_name
FROM reviews AS r
JOIN firms AS f ON f.firms_id = r.review_target_id
WHERE r.review_id =3
ORDER BY r.review_timestamp DESC
LIMIT 0 , 30
It gives me two columns, exactly what I need.
However, this only gives me one column, "review_id":
$this->db->select('review_id', 'firms_name');
$this->db->from('reviews as r');
$this->db->join('firms as f', 'f.firms_id = r.review_target_id');
$this->db->where('r.review_id', $id);
$this->db->order_by('r.review_timestamp', 'desc');
$query = $this->db->get();
If I delete the 'select' clause, I get all the information I need, but would like to understand what I'm doing wrong and how I can reduce the load on my db. Any thoughts?