[eluser]Jailbird[/eluser]
Correct me if I'm wrong, but up to my knowledge,
Code:
$data['query'] = $this->db->where('categories_id',$this->uri->segment(3));
$data['query'] = $this->db->from('produits');
$data['total'] = $this->db->count_all_results();
or
Code:
$data['query'] = $this->db->where('categories_id',$this->uri->segment(3));
$data['total'] = $this->db->count_all_results('produits');
produces the following query:
Code:
SELECT COUNT(*) AS `numrows` FROM (`produits`) WHERE `categories_id` = '$this->uri->segment(3)'
with correctly counted rows.
Whereas the OP's,
Code:
$data['query'] = $this->db->get_where('produits', array('categories_id' => $this->uri->segment(3)));
$data['total'] = $this->db->count_all_results();
results in:
Code:
SELECT * FROM (`produits`) WHERE `user_type_id` = '$this->uri->segment(3)'
Seems like a working solution, but might be I'm not using a pattern efficient enough?