how to allow only one vote for a rating system

前端 未结 2 767
有刺的猬
有刺的猬 2021-01-17 06:27

guys i have made a jquery and css based star rating system. now i cant really think of way as how to save the user vote to database. and most importantly how to limit one us

2条回答
  •  独厮守ぢ
    2021-01-17 07:20

    Look into structuring your database with indexes. I created a user favorite system that only allows one row to be inserted per user/favorite combination. For example: a user chooses a favorite, the values stored in the database are User ID and Favorite ID. If the user tries to select it again, the database won't insert the row as it is an exact duplicate.

提交回复
热议问题