Jaynesh Posted July 9, 2011 Share Posted July 9, 2011 Hello I've got a table. vote(user_id, post_id, up, down) Ive assigned post_id a UNIQUE and setup a DUPLICATE KEY UPDATE in my query. This prevents the user voting on the same post again. However the post_id isnt linked with user_id so it means that other users can't vote on 'post_id' if it already exists in the table. How do I make it see 'user_id' + 'post_id' as UNIQUE so other user_id's can vote on the same post? Quote Link to comment https://forums.phpfreaks.com/topic/241506-duplicate-key-update/ Share on other sites More sharing options...
IrOnMaSk Posted July 13, 2011 Share Posted July 13, 2011 hey Jaynesh this tutorial might help. Give it a try. http://www.w3schools.com/sql/sql_unique.asp disclaimer: errr w3school didn't have good reputation in the pass!!! Quote Link to comment https://forums.phpfreaks.com/topic/241506-duplicate-key-update/#findComment-1242472 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.