Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Vote Candidate System
#3

(11-05-2016, 01:52 AM)sv3tli0 Wrote: If 1 user can vote just once for 1 candidate, I think that it will be easier for you instead of vote status 0|1,  to have field voted_for - which will keep the candidate ID ..
So when its NULL or 0 this mean that the user has not voted yet..

In case that such votes will be not just once per your site life it will be better if you do that in a separate table "user_votes"
With 3 fields :

User_id : the id of the one who set vote,
Candidate_id : the id of the candidate
Vote_id : the id of the Vote (this field will separate each voting campaign as: summer2016, winter2017 and etc..)

In this case you can add and unique index for ( user_id + vote_id ) which will limit users to vote just once per campaign.

Thanks for your suggestion. But my problem is how to create a vote function i'm stuck on it. I already create a separate table for user.
Reply


Messages In This Thread
Codeigniter Vote Candidate System - by bagusbal - 11-04-2016, 11:20 PM
RE: Codeigniter Vote Candidate System - by bagusbal - 11-06-2016, 07:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB