PHP/MySQL:在投票系统中,如何阻止用户看到他已经投票过的个人资料?
一般来说,如何阻止用户看到他已经投票过的个人资料,以免他对其投票两次?
我有一个用户表(称为“用户”),每个用户都有一个唯一的用户 ID(列为“userID”),我还有另一个表(称为“投票”),用于每个用户向另一个用户提供的每次投票(使用他们各自的投票)用户 ID 的列为“fromUser”、“toUser”、“vote”),因此,如果我想向用户显示一个新的随机配置文件进行投票,那么排除当前用户已投票的任何用户的最佳方法是什么上(换句话说,排除任何“userID”,其中“userID”是“toUser”,“fromUser”是当前用户的用户ID)。
谢谢!
Generally speaking, how can I keep a user from seeing a profile he has already voted on so that he does not vote on it twice?
I have a table (called "Users") of users each with a unique user ID (with column "userID"), I have another table (called "Votes") for each vote given by each user to another user (using their respective user ID's with columns "fromUser", "toUser", "vote"), so if I want to show a user a new random profile to vote on, then what is the BEST way to exclude any users where the current User has already voted on (in other words, exclude any "userID" where the "userID" is the "toUser" and where the "fromUser" is the current user's userID).
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该可以解决问题。
This should do the trick.