If I understand correctly, you're filling the field that is inserted in uniqueID
on the client-side, such that if a form is submitted twice with the same id, you would reject it. If this is the case, I would consider the following:
You may want to define a unique constraint on the uniqueID
field, so that you will be able to enforce the constraint on a database level:
CREATE TABLE acomments (
...
UNIQUE (uniqueID),
...
);
But you can also eliminate this field altogether, and simply add some logic in your application such that when a comment is submitted by a user, and the comment contains the same body text as the previous comment submitted by the user on the same answer, then reject it. In most situations, I believe I would go with this approach. It is not that important to enforce this rule on the database-level, since the data integrity will not be compromised. Pseudo example:
function commentSubmitted ($userID, $articleID, $commentBody) {
$lastComment = queryDatabase("SELECT comment
FROM acomments
WHERE user_id = $userID AND
article_id = $articleID
ORDER BY dateCREATE DESC
LIMIT 1")
if ($lastComment == $commentBody) {
// Duplicate submission ...
}
else {
// Insert new comment into the database ...
}
}