scooter41 Posted October 23, 2007 Share Posted October 23, 2007 Hi There, I am just about to start work on a large community based website, whereby a lot of the content is created based on membership voting / rating other members articles / photos / pictures etc.... This will probably have a large user base, so I was wondering what the best way to allow only unique votes per user? If I had a table for votes.... with the user ID and articleID for example, this would be fine for a low count, but if there are 20k articles with 20k users... this surely wouldnt be advisable.... Does anyone have any thoughts of how to cover this? Cookies I guess is one way, but its not very reliable or fool proof! Quote Link to comment https://forums.phpfreaks.com/topic/74496-voting-system-preventing-duplicate-votes/ Share on other sites More sharing options...
atlanta Posted October 23, 2007 Share Posted October 23, 2007 using the database is the most reliable you just have to code the query good so that it doesnt cause the DB/server to lag Quote Link to comment https://forums.phpfreaks.com/topic/74496-voting-system-preventing-duplicate-votes/#findComment-376465 Share on other sites More sharing options...
GingerRobot Posted October 23, 2007 Share Posted October 23, 2007 Its highly unlikely that all or your 20,000 users would vote on all of your 20,000 articles. I don't think storing each individual vote is an issue at all. And i don't think there is any other way either. Quote Link to comment https://forums.phpfreaks.com/topic/74496-voting-system-preventing-duplicate-votes/#findComment-376467 Share on other sites More sharing options...
manixrock Posted October 23, 2007 Share Posted October 23, 2007 as GingerRobot said, storing each individual vote on a "votes" table is the best way. Mysql is optimized specially for large numbers of rows. Quote Link to comment https://forums.phpfreaks.com/topic/74496-voting-system-preventing-duplicate-votes/#findComment-376470 Share on other sites More sharing options...
roopurt18 Posted October 23, 2007 Share Posted October 23, 2007 Not to mention that a properly indexed MySQL database should be able to handle millions of records. If you did manage to have so much data that performance really became an issue, you would want to look into maybe pre-calculation or load balancing. Quote Link to comment https://forums.phpfreaks.com/topic/74496-voting-system-preventing-duplicate-votes/#findComment-376475 Share on other sites More sharing options...
scooter41 Posted October 23, 2007 Author Share Posted October 23, 2007 ok perfect, thank you for the reassurance... I wanted to check that was the common way to do it and not just a quick fix... there will be votes on articles, blog posts, images, profiles etc, so i guess I could make a seperate votes table for each category. thanks for taking the time to post! Quote Link to comment https://forums.phpfreaks.com/topic/74496-voting-system-preventing-duplicate-votes/#findComment-376545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.