Welcome Guest, Not a member yet? Register   Sign In
categories display problem show all categories
#7

You have to add a where clause to your model like

PHP Code:
public function get_categories($category_name false$order_by null$sort 'DESC'$limit null$offset 0) {
        
$this->db->select('a.*, c.name as category_name');
        
$this->db->from('articles as a');
        
$this->db->join('categories AS c''a.category_id = c.id ','LEFT');
        if (
$category_name)
        {
            
$this->db->where('categories.name'$category_name);
        }
        if(
$limit != null) {
            
$this->db->limit($limit$offset);
        }
        if(
$order_by != null) {
            
$this->db->order_by($order_by$sort);
        }
        
$query $this->db->get();
        return 
$query->result();


Or you check the where with the category id ..

Reply


Messages In This Thread
RE: categories display problem show all categories - by Rufnex - 01-16-2015, 03:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB