[eluser]jedd[/eluser]
Hi Jesse. Absent a schema for accuracy, I'd do something like this (because I'm not comfy with CI's AR stuff, mostly)
Code:
$query = $this->db->query (" SELECT prod_id, prod_name, prod_this, prod_that,
category.title as cat_title,
category.description as cat_desc
FROM product
LEFT JOIN
category ON category.id=product.category
WHERE prod_id=". $foo ); // the WHERE is entirely optional of course
Oh .. you might not need the SELECT part, but you should in general avoid
select * as you usually don't want everything, and more importantly in joins and multi-table selects you want to avoid, or at least minimize, the pain and confusion that arises from handling fields with the same name that come from different tables. 'id' being the obvious and most common candidate. Hence the judicious use of 'AS' (gotta love the AS).