active record summation in codeigniter
That should do the trick:
$this->db->select('SUM(type) as score');$this->db->where('question_id',1);$q=$this->db->get('votes');$row=$q->row();$score=$row->score
Your $score
variable now contains the sum of the type
s for that particular question.
Hope that helps!