Welcome Guest, Not a member yet? Register   Sign In
countvotes
#1

[eluser]benfike[/eluser]
Hi!

How can I count the answer for the votes_answers?

votes_votes table structure:
id
ansid - answer id
voteid - the poll id
userid - userid
Code:
function countVotesByAnsId($id){
        $this->db->where('ansid',$id);
        $data = '+';
        $Q = $this->db->get('votes_votes');
        if($Q->num_rows() > 0){
            $data = $Q->num_rows();
        }
        $Q->free_result();
        return $data;
    }
Whats the problem with that code?

Now only count the first Answer, answers.


Messages In This Thread
countvotes - by El Forum - 09-06-2009, 04:31 AM
countvotes - by El Forum - 09-06-2009, 05:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB