I have a mysql tables...
'users' with uname(a string) as the primary key. 'posts' with id as the primary key.
'posts' has a columnm- 'votes'
When a user is logged in, he can vote posts. The problem is how do i stop him from voting more than once?
Link:(Note: $q is id of the post)
<a href='./vote.php?upid=".$q."'>Upvote</a>
PHP:
if(isset($_GET["upid"])) {
$plus = $_GET["upid"];
$query = "UPDATE posts SET votes = votes + 1 WHERE id='$plus'";
$result = mysqli_query($dbc, $query) or die('Error querying database!');
}