• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inner join default

#1
[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"?

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.