Forums

Fatal error: Call to a member function on a non-object (1 post)

  1. dropnby
    Member
    Posted 4 years ago #

    I am getting the following error on my pages when I try to insert data. I am new to writing a plug-in and have run out of ideas on how to correct this one. Any help would be greatly appreciated. Here is my code....

    global $wpdb;

    $table_name = "wpv_table";

    $payer_email = "email_69@yahoo.com";
    $first_name = "Lucy";
    $last_name = "Smith";
    $txn_id ="5555";
    $payment_status = "Completed";
    $custom="Ashley Stewart - Hidden on homepage";
    $auction_buyer_id = "";
    $auction_item_number = "";
    $item_number = "47";
    $key = "47";
    $sku = "";

    $insert = "INSERT INTO " . $table_name .
    " (payer_email, first_name, last_name, txn_id, payment_status, custom, auction_buyer_id, auction_item_number, item_number, key, sku, datetime) " .
    "VALUES ('" . $wpdb->escape($payer_email) . "','" . $wpdb->escape($first_name) . "','" . $wpdb->escape($last_name) . "','" . $wpdb->escape($txn_id) . "','" . $wpdb->escape($payment_status). "','" . $wpdb->escape($custom) . "','" . $wpdb->escape($auction_buyer_id) . "','" . $wpdb->escape($auction_item_number) . "','" . $wpdb->escape($item_number) . "','" . $wpdb->escape($sku) . "','" . time() . "')";

    function insert_order($content) {
    $results = $wpdb->query( $insert );

    }

    add_filter('the_content', 'insert_order');

Topic Closed

This topic has been closed to new replies.

About this Topic