How Can I Code A Category / Sub Category Database Query (One Level Deep) In Codeigniter?

After a little messing around, I realised that my second join was wrong. Here is my updated and working code in hopes it helps someone else $this->db->select('l. *'); $this->db->select('c.

Cat_parent, c. Cat_slug, c. Cat_name, c.

Cat_description, c. Cat_display'); $this->db->select('pc. Cat_slug AS parent_cat_slug, pc.

Cat_name AS parent_cat_name, pc. Cat_description AS parent_cat_description, pc. Cat_display AS parent_cat_display'); $this->db->limit($limit, $offset); $this->db->join('listing_status ls', 'ls.

Status_id = l. Listing_status'); $this->db->join('categories c', 'c. Cat_id = l.

Listing_category'); $this->db->join('categories pc', 'pc. Cat_id = c. Cat_parent'); return $this->db->get('listings l')->result().

After a little messing around, I realised that my second join was wrong. Here is my updated and working code in hopes it helps someone else. $this->db->select('l.

*'); $this->db->select('c. Cat_parent, c. Cat_slug, c.

Cat_name, c. Cat_description, c. Cat_display'); $this->db->select('pc.

Cat_slug AS parent_cat_slug, pc. Cat_name AS parent_cat_name, pc. Cat_description AS parent_cat_description, pc.

Cat_display AS parent_cat_display'); $this->db->limit($limit, $offset); $this->db->join('listing_status ls', 'ls. Status_id = l. Listing_status'); $this->db->join('categories c', 'c.

Cat_id = l. Listing_category'); $this->db->join('categories pc', 'pc. Cat_id = c.

Cat_parent'); return $this->db->get('listings l')->result().

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions