Welcome Guest, Not a member yet? Register   Sign In
news category and subcategory
#1

(This post was last modified: 12-10-2014, 05:20 AM by paju89.)

i have table CAT if parent_id is set to zero its main if not its subcategory
cat_id | name |parent_id
1 Bob 0
2 John 1
3 Mike 1



and table NEWS

id | cat_id | title | text
1 1 text some text
2 2 any any text
3 3 another another text


my url structure is ..mysite/page/cat_id

question is if i click on link BOB whos id is 1 i want to get all data from NEWS table with title (text, any, another)
and if i click on link John whos id is 2 i want to get all data from NEWS table with title (any)
and if i click on link Mike whos id is 3 i want to get all data from NEWS table with title (another)


below is code i write only gives me news set to its cat_id not working for main category bob.
PHP Code:
$this->db->select('*');      
         
$this->db->where('cat_id'$cat_id);       
         
$query $this->db->get("news");
       return 
$query->result(); 
Reply


Messages In This Thread
news category and subcategory - by paju89 - 12-10-2014, 05:14 AM
RE: news category and subcategory - by _this - 12-10-2014, 07:32 AM
RE: news category and subcategory - by paju89 - 12-10-2014, 08:57 AM
RE: news category and subcategory - by paju89 - 12-10-2014, 08:47 AM
RE: news category and subcategory - by _this - 12-10-2014, 08:59 AM
RE: news category and subcategory - by paju89 - 12-10-2014, 09:04 AM
RE: news category and subcategory - by _this - 12-10-2014, 12:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB