Welcome Guest, Not a member yet? Register   Sign In
2 idiot Question for poll system
#1

[eluser]benfike[/eluser]
I have an vote script. Have an result view too.

I want that the system display the result of the poll in rows.


I have 3 tables for this..

this is the structure:
@votes.question
-voteid
-question
-date
-status

@votes_answer
-ansid
-voteid
-answer
@votes_votes
-id
-voteid
-ansid
-userid

So in this poll, only Users Can Vote.

Now my result.php in view:
Code:
<h2>&lt;?php echo htmlspecialchars($poll['question']) ?&gt;</h2><br><br>

        &lt;?php foreach($answers as $answer):?&gt;

                    <strong>&lt;?php echo ($answer['answer']) ?&gt;</strong>
                    - votes <i>&lt;?php echo $vote;?&gt;</i><br>
            &lt;?php
            endforeach;
            ?&gt;
<br />
    
    <p>Szavazatok száma: &lt;?php echo $all_votes;?&gt;</p><br />
    <p><a href="&lt;?php echo site_url('szavazas/regebbi') ?&gt;">Régebbi szavazások</a></p>

My other problem, how can I count how much votes comes for a answer?

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;
    }

But this dont work:/

The pull can be found at: http://www.arsenalfan.hu/szavazas

and the result view at: http://www.arsenalfan.hu/szavazas/eredmeny/1




Theme © iAndrew 2016 - Forum software by © MyBB