I am trying to do a more or less routine insert however my code appears to be being called twice. Here is said code:
$market_arr = array(
'market_name' => $market,
'future_market_code' => $future_code,
'fx_market_code' => $fx_code,
'cfd_market_code' => $cfd_code,
'etf_market_code' => $etf_code,
'option_market_code' => $option
);
$wpdb->insert('bu_trade_market', $market_arr);
$market_id = $wpdb->get_var($wpdb->prepare("SELECT market_id FROM bu_trade_market ORDER BY market_id DESC LIMIT 1"));
As it may have a bearing:
- The code is in a plugin file
- The code is being called by the page via a function courtesy of
exec-php- Function literally consists of
require('page-in-question.php');
- Function literally consists of
- I have tried disabling all plugins save my custom plugin and
exec-php - I have tried adding
$wpdb->flush()to the end of the page - It inserts once if I put
exit;at the base of the file but fails to load the template.
I am EXTREMELY hesitant to make a custom template file for this as it would mean I will need ~100 custom template files.
My question essentially is this: How do I stop it from executing twice.