CodeIgniter Forums

Full Version: countvotes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


How can I count the answer for the votes_answers?

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

Now only count the first Answer, answers.

El Forum

the rsult view:
<?php foreach($answers as $answer):?>

                    <strong><p>&lt;?php echo ($answer['answer']) ?&gt;</p></strong>
                    &lt;? print "<img >"; ?&gt;
                    szavazatok száma &lt;?php echo $szavazat;?&gt;<br />

here is the $szavazat = that function