Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $wpdb;
- $wpdb->show_errors();
- $webinar = "<a href=\"https://elitetraders.omnovia.com/\" target=\"_blank\">Live Cast</a>";
- $section = $_POST['section'];
- $direction = $_POST['direction'];
- $code = $_POST['code'];
- $chart = $_POST['chart'];
- $price = $_POST['price'];
- $stop_loss = $_POST['stop'];
- $profit_target = $_POST['target'];
- $risk_summary = $_POST['risk'];
- $trade_review = $_POST['analysis'];
- $out_id = 4;
- $status_id = 1;
- $pre = $_GET['pre'];
- $type = $_GET['type'];
- // Made redundant by testing
- //if ($pre) {
- // pre_trade($code, $direction, $type, $webinar, $chart, $out_id, $price, $stop_loss, $profit_target, $risk_summary, $trade_review);
- //} else {
- // INSERT new trade as most recent
- $recent_arr = array('trade_date' => 'NOW()', 'most_recent' => '1');
- $wpdb->insert('bu_trade', $recent_arr);
- // Get most recent trade, should be the one above
- $recent_query = "SELECT * FROM bu_trade WHERE most_recent = 1";
- $recent_trade = $wpdb->get_row($recent_query);
- // Get the variables to create the transaction
- $trade_date = $recent_trade->trade_date;
- $trade_id = $recent_trade->trade_id;
- // Create array of values to be entered
- $new_trans_array = array(
- 'trade_id' => $trade_id,
- 'trans_date' => $trade_date,
- 'direction' => $direction,
- 'terminology' => $terminology,
- 'section_id' => $section,
- 'code_id' => $code,
- 'status_id' => $status_id,
- 'chart_id' => $chart,
- 'out_id' => $out_id,
- 'price' => $price,
- 'stop_loss' => $stop_loss,
- 'profit_target' => $profit_target,
- 'risk_summary' => $risk,
- 'trade_review' => $trade_review,
- 'trademe' => TRUE,
- 'webinar' => $webinar
- );
- // Insert above array
- $wpdb->insert('bu_trade_transactions', $new_trans_array);
- // Get Trans_ID
- $trans_id = $wpdb->get_var($wpdb->prepare("SELECT trans_id FROM bu_trade_transactions WHERE trade_id='$trade_id' ORDER BY trans_id DESC LIMIT 1"));
- // If custom Code
- if ($code == '39') {
- $other_name = $_POST['other_code_name'];
- $other_code = $_POST['other_code_id'];
- $other_set = array(
- 'other_name' => $other_name,
- 'other_code' => $other_code
- );
- $other_where = array(
- 'trans_id' => $trans_id
- );
- $wpdb->update('bu_trade_transactions', $other_set);
- }
- // Reset most recent
- $reset_set = array(
- 'most_recent' => 0,
- 'trans_id' => $trans_id
- );
- $reset_where = array(
- 'trade_id' => $trade_id
- );
- $wpdb->update('bu_trade', $reset_set, $reset_where);
- // pass to table being displayed
- tm_table($trans_id, $trade_id);
- //}
- $wpdp->flush();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement