0

I have this block of code which getting executed twice when the post hits from the payment gateway.Any help will be welcome on this issue. I have already checked the code there is no 404 resuest to any script.

$stmt = $dbAdapter->prepare('EXEC MyProcedure  ?,?,?,?,?,?,?,?');
$stmt->bindParam(1,$id,  PDO::PARAM_INT);
$stmt->bindParam(2,$Transaction,  PDO::PARAM_STR);
$stmt->bindParam(3,$Person_id,  PDO::PARAM_STR);
$stmt->bindParam(4,$Amount);
$stmt->bindParam(5,$OrderID,  PDO::PARAM_STR);
$stmt->bindParam(6,$BankClientID,  PDO::PARAM_STR);
$stmt->bindParam(7,$Transaction_Time,  PDO::PARAM_STR);
$stmt->bindParam(8,$status, PDO::PARAM_INT);
$id = $stmt->execute();
amarjit singh
  • 463
  • 5
  • 14
  • 2
    This piece of code cannot be executed twice... your error must be in another part – Sal00m Sep 10 '14 at 13:38
  • I handle the post from payment gateway . As soon as post hit i parse,prepare and execute the store procedure on a zend Framework 1 Application. But when the data goes in the database i see two entries – amarjit singh Sep 10 '14 at 13:41
  • I even had checked with static fiels as well but it is still executing twice – amarjit singh Sep 10 '14 at 13:42
  • 1
    I agree with Sal00m. Do a simple check to see if PHP executes the code twice, and therefore you get 2 entries in the database. Many gateways send multiple messages, in my experience. – KIKO Software Sep 10 '14 at 13:43
  • If you can't find why it's doing that, as a last resort, you can set your affected column(s) as UNIQUE. Check to see if you're not including the file twice somewhere. – Funk Forty Niner Sep 10 '14 at 13:44
  • 1
    Thanks KIKO,Fred for your tips.I will check that – amarjit singh Sep 10 '14 at 13:50
  • You're welcome. Have a look at http://dev.mysql.com/doc/connector-net/en/connector-net-programming-tracing-mysql.html and http://stackoverflow.com/q/568564/ and http://www.howtogeek.com/howto/database/monitor-all-sql-queries-in-mysql/?PageSpeed=noscript - Found those while Googling "trace mysql" if you wish to further your research, *cheers* – Funk Forty Niner Sep 10 '14 at 14:14

0 Answers0