CodeIgniter Forums
Inner join default - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Inner join default (/showthread.php?tid=52405)



Inner join default - El Forum - 06-09-2012

[eluser]Gabi3xz[/eluser]
i have a code, function good
Code:
$this->db->select('article.id, article.article_cat, categories.cat_name')
     ->join('categories', 'article.article_cat = categories.id')
     ->get('article', $config['per_page'], $this->uri->segment(3));
This code make a inner join between 'article_cat' and 'categories.id' give me 'cat_name',

Problem is
Example i have article_cat[5] and if not exist number 5 in categories.id, will not show result.

How can I give a default "Uncategorized"?


Inner join default - El Forum - 06-09-2012

[eluser]Gabi3xz[/eluser]
if category 5 does not exists to be replaced automatically by a default category