Welcome Guest, Not a member yet? Register   Sign In
Active Record Error
#1

[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


Messages In This Thread
Active Record Error - by El Forum - 03-20-2009, 02:57 PM
Active Record Error - by El Forum - 03-20-2009, 03:16 PM
Active Record Error - by El Forum - 02-24-2010, 07:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB