PHP: MySQL query duplicating update for no reason

前端 未结 3 1803
深忆病人
深忆病人 2021-01-27 01:54

The code below is first the client code, then the class file.

For some reason the \'deductTokens()\' method is calling twice, thus charging an account double. I\'ve been

相关标签:
3条回答
  • 2021-01-27 02:27

    I know this will sound strange but make sure that you don't have tag with empty src="" attribute or any css style refering to empty url (like background: url();) on your site around the place when you have your code that runs twice.

    Read about some trouble this may cause here: http://hi.baidu.com/zhenyk/blog/item/38a1051fc63b96c3a686698f.html

    0 讨论(0)
  • 2021-01-27 02:29

    Another long shot, but it happened to me once in Firefox - doubled page executions, resulting in doubled inserts and updates - close your browser and restart.

    0 讨论(0)
  • 2021-01-27 02:37

    The line:

    header('location: account.php');
    

    Forwards the browser, but doesn't end the php script.
    This might be fine, the code-snippet you gave doens't "do" anything after this line.

    Another option might be a double-click
    If you double-click on the submit button, the form will be sent twice.
    We used some javascript to disable the submit button after the first click.

    0 讨论(0)
提交回复
热议问题