SQL Insert executes twice, php

后端 未结 2 1916
轮回少年
轮回少年 2020-12-12 08:03

Couldn\'t find a straight answer to this. My custom wordpress php code seems to be executed twice when I click on the submit once. When clicked, the codes adds two cities wi

2条回答
  •  借酒劲吻你
    2020-12-12 08:47

    you execute the query twice:

    $result = $db->query($query);
    if ($db->query($query) === TRUE) {
    

    should be:

    $result = $db->query($query);
    if ($result === TRUE) {
    

提交回复
热议问题