Welcome Guest, Not a member yet? Register   Sign In
problem with active records class
#1

[eluser]dsi[/eluser]
hey,
i m using the following code to fetch data from database but it isn't showing any results, can anyone plz point out what is wrong with my code.

Code:
$tables='product, category, sub_category';
$conditions=array(
    'product.category_id'=>'category.id',
    'product.sub_category_id'=>'sub_category.id'
);
$offset=$this->uri->segment(3);
$q=$this->db->get_where($tables, $conditions);
if($q->num_rows()>0){
    return $q->results();
}

I have used the same statement in phpmyadmin and it shows result. Am i doing anything wrong here??

I used this code in phpmyadmin
Code:
SELECT * FROM product, category, sub_category where product.category_id=category.id and product.sub_category_id=sub_category.id

thank you
#2

[eluser]dsi[/eluser]
also if i would like to use it with ci paginatio then which code should i use?
is it okay if i use get_where($tables, $condition, $config['per_page'], $this->segment(3));




Theme © iAndrew 2016 - Forum software by © MyBB