[eluser]satanrulehis[/eluser]
Hi all!
I want to pagination,I have a problem with my sql like this:
Code:
$this->db->where('product_catalog.id', $catalogid);
$this->db->where('product.active', 1);
$this->db->from('product_catalog');
$this->db->join('product', 'product_catalog.id = product.catalog_id');
$this->db->select('product_catalog.name as catalogname, product.id, product.name, product.product_code, product.small_pic, product.price');
It work:
Code:
$query = $this->db->get();
It doesn't work:
Code:
$query = $this->db->get($num, $offset);
Another question is: if I change this active record to normal sql, it doesn't work when I add $num, $offset into it
Code:
$sql = "SELECT c.name as catalogname,p.id,p.name,p.product_code,p.small_pic,p.price FROM product p, product_catalog c where c.id=".$catalogid." and c.id=p.catalog_id and p.active=1 limit ".$offset.",".$num;
Thanks all for reading