I need a little advice on table layout for a polling system.
I abandoned a project probably a year ago now, but I took a fresh look at it today and got excited about it again so I'm looking to get around the issue I had when I quit so I can get this project moving again! Basically I'm setting up a polling system so I was intending on recording the IP address of each vote but I couldn't figure out if that would work well because IP addresses change constantly, so now I'm planning on simplifying it and just requiring that you must be a user and thus record the userid for each vote.
Anyways, I'm setting up a votes table and I'm planning on it recording a voteid (automatically & unique), choiceid (given to each poll option so I can tally the number of votes per option), and userid and then when verifying a vote I will check if there is an entry in the votes table with the current userid, and choiceid, and if there is an entry that matches then it will tell the user that they already voted, et cetera. I guess I'm looking for feedback, and whether or not this makes sense and if it is efficient. Also isn't there a way to, instead of having a voteid, have a multi column primary key?