[eluser]philpalmieri[/eluser]
Hey,
Best way i have found is to just do two queries
Code:
function get()
{
if ($this->brandid)
{
$this->db->where('brandid', $this->brandid);
}
//Select Just the count in 1 result
$this->db->select('COUNT(*) as ttl');
$total = $this->db->get('product')->row();
$total = $total->ttl;
//Your paginated/limit query
if ($this->brandid)
{
$this->db->where('brandid', $this->brandid);
}
$this->db->limit($howManyYouWant, $offset);
$query = $this->db->get('product');
return $query;
}