检查最近10秒内是否有重复记录

Is it possible to check if a duplicate record has been inserted within the last 10 or 20 seconds?

As for now I am doing this:

INSERT INTO user_pointshistory (ptimestamp, player, points) VALUES (NOW(),'$playerid',$thisPoints)

What I want to check on is a record from the same player with the exact same points has been inserted within the last 10 seconds!

Can this be done?

------------- EDIT --------------

I have now tried this but with no luck? Shouldn't I be able to do this?

$sql = "SELECT * FROM user_pointshistory WHERE player='111' AND points=10000 AND ptimestamp < DATE_SUB(NOW(), INTERVAL 10 SECOND)";
$result = mysqli_query($conn,$sql) or die(mysqli_error());
if($row = mysqli_fetch_array($result)){
    echo 'GOT A RECORD';
} else {
    echo 'READY FOR AN RECORD';
    $sql = "INSERT INTO user_pointshistory (ptimestamp, player, points) VALUES (NOW(),'111',10000)";
    mysqli_query($conn,$sql);
}

Hoping for help and thanks in advance :-)

I strongly second rjdown's response in that you should create a timestamp, so you can first check the database with the timestamp stored and a new timestamp generated before submitting the new row.

The following won't work, because $row is undefined, where you would be best using mysqli_num_rows() to check if the row exists.

if($row = mysqli_fetch_array($result)){

I would replace that with:

$numrows = mysqli_num_rows($result); 
  if($numrows > 0){ 
    echo "GOT A RECORD"; 
}

while as you said in comments, turning the < in ptimestamp < DATE_SUB to an >