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
Do you see this
$result = $db->query($query);
And the next line:
if ($db->query($query) === TRUE) {
This means that you run your query twice. Remove one of the $db->query
, e.g.:
$result = $db->query($query);
if ($result === TRUE) { /* do stuff */
you execute the query twice:
$result = $db->query($query);
if ($db->query($query) === TRUE) {
should be:
$result = $db->query($query);
if ($result === TRUE) {