I have that PDO query to check for duplicate txn_id
in my database. At the moment my database has NO
record.
Everytime I run my ipn script on paypal sandbox
I keep getting the email saying Duplicate Transaction ID.
I dont get it. I have no record in my database so the transaction should have gone though.
Can anyone spot an error please.
$this_txn = $_POST['txn_id'];
$stmt = $conn->prepare("
SELECT txn_id FROM Transactions
WHERE txn_id =:txn_id LIMIT 1
");
$stmt->bindParam('txn_id',$this_txn);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($rows > 0) {
$messagerr = "Duplicate Transaction ID.";
mail("example@test.com", "Duplicate txn_id in the IPN system", $messagerr, "From: test@example.com" );
exit();
}