Warning mysqli_real_escape_string create new order

Hi guys,
When create a new order at my store, it appears that are some erros, because it generates a warning. Could you help me with that?

  • Danilo

    Hi Ari,
    Tried to add an attachment, but no sucess. There is the stack of the error:

    [25-Oct-2014 15:09:44 UTC] PHP Warning:  mysqli_real_escape_string() expects parameter 2 to be string, object given in C:\wamp\www\wordpress4\wp-includes\wp-db.php on line 1038
    [25-Oct-2014 15:09:44 UTC] PHP Stack trace:
    [25-Oct-2014 15:09:44 UTC] PHP   1. {main}() C:\wamp\www\wordpress4\index.php:0
    [25-Oct-2014 15:09:44 UTC] PHP   2. require() C:\wamp\www\wordpress4\index.php:17
    [25-Oct-2014 15:09:44 UTC] PHP   3. wp() C:\wamp\www\wordpress4\wp-blog-header.php:14
    [25-Oct-2014 15:09:44 UTC] PHP   4. WP->main() C:\wamp\www\wordpress4\wp-includes\functions.php:873
    [25-Oct-2014 15:09:44 UTC] PHP   5. do_action_ref_array() C:\wamp\www\wordpress4\wp-includes\class-wp.php:623
    [25-Oct-2014 15:09:44 UTC] PHP   6. call_user_func_array:{C:\wamp\www\wordpress4\wp-includes\plugin.php:580}() C:\wamp\www\wordpress4\wp-includes\plugin.php:580
    [25-Oct-2014 15:09:44 UTC] PHP   7. MarketPress->load_store_templates() C:\wamp\www\wordpress4\wp-includes\plugin.php:580
    [25-Oct-2014 15:09:44 UTC] PHP   8. MarketPress->update_cart() C:\wamp\www\wordpress4\wp-content\plugins\marketpress\marketpress.php:1301
    [25-Oct-2014 15:09:44 UTC] PHP   9. do_action() C:\wamp\www\wordpress4\wp-content\plugins\marketpress\marketpress.php:3574
    [25-Oct-2014 15:09:44 UTC] PHP  10. call_user_func_array:{C:\wamp\www\wordpress4\wp-includes\plugin.php:505}() C:\wamp\www\wordpress4\wp-includes\plugin.php:505
    [25-Oct-2014 15:09:44 UTC] PHP  11. MP_Gateway_Braspag->process_payment() C:\wamp\www\wordpress4\wp-includes\plugin.php:505
    [25-Oct-2014 15:09:44 UTC] PHP  12. MarketPress->create_order() C:\wamp\www\wordpress4\wp-content\themes\leandrostormer\braspag-payment-gateway.php:536
    [25-Oct-2014 15:09:44 UTC] PHP  13. do_action() C:\wamp\www\wordpress4\wp-content\plugins\marketpress\marketpress.php:3941
    [25-Oct-2014 15:09:44 UTC] PHP  14. call_user_func_array:{C:\wamp\www\wordpress4\wp-includes\plugin.php:505}() C:\wamp\www\wordpress4\wp-includes\plugin.php:505
    [25-Oct-2014 15:09:44 UTC] PHP  15. CoursePress->enroll_on_payment_confirmation() C:\wamp\www\wordpress4\wp-includes\plugin.php:505
    [25-Oct-2014 15:09:44 UTC] PHP  16. MarketPress->get_order() C:\wamp\www\wordpress4\wp-content\plugins\coursepress\coursepress.php:1183
    [25-Oct-2014 15:09:44 UTC] PHP  17. MarketPress->order_to_post_id() C:\wamp\www\wordpress4\wp-content\plugins\marketpress\marketpress.php:3957
    [25-Oct-2014 15:09:44 UTC] PHP  18. wpdb->prepare() C:\wamp\www\wordpress4\wp-content\plugins\marketpress\marketpress.php:4099
    [25-Oct-2014 15:09:44 UTC] PHP  19. array_walk() C:\wamp\www\wordpress4\wp-includes\wp-db.php:1172
    [25-Oct-2014 15:09:44 UTC] PHP  20. wpdb->escape_by_ref() C:\wamp\www\wordpress4\wp-includes\wp-db.php:1172
    [25-Oct-2014 15:09:44 UTC] PHP  21. wpdb->_real_escape() C:\wamp\www\wordpress4\wp-includes\wp-db.php:1114
    [25-Oct-2014 15:09:44 UTC] PHP  22. mysqli_real_escape_string() C:\wamp\www\wordpress4\wp-includes\wp-db.php:1038
  • Danilo

    Hi Chelle,
    No, I don't have those 2 marketpress activated. At my payment gateway, I call the create_order function like this:

    $result = $mp->create_order($_SESSION['mp_order'], $cart, $shipping_info, $payment_info, $paid);

    /**
     * debug create_order
     */
    echo "mp_order: ".print_r($_SESSION['mp_order'])."\n";
    echo "cart: ".print_r($cart)."\n";
    echo "shipping_info: ".print_r($shipping_info)."\n";
    echo "payment info: ".print_r($payment_info)."\n";
    echo "paid: ".print_r($paid)."\n";
    exit();
    $result = $mp->create_order($_SESSION['mp_order'], $cart, $shipping_info, $payment_info, $paid);

    then it returns this:

    65925cfc17cbmp_order: 1
    Array
    (
        [290] => Array
            (
                [0] => Array
                    (
                        [SKU] =>
                        [name] => Comprando Ações e Vendendo Opções
                        [url] => https://192.168.1.181/wordpress4/loja/produtos/comprando-acoes-e-vendendo-opcoes/
                        [price] => 79.00
                        [quantity] => 1
                        [download] =>
                    )
    
            )
    
    )
    cart: 1
    Array
    (
        [email] => danilo@email.com
        [name] => Danilo
        [address1] => Rua blablablqa
        [address2] => Rua blablablqaRua blablablqa
        [city] => hjb
        [state] => PR
        [zip] => bjhbjhb
        [country] => BR
        [phone] =>
    )
    shipping_info: 1
    Array
    (
        [gateway_public_name] => Cartão de Crédito
        [gateway_private_name] => Braspag
        [method] => Cartão de Crédito
        [status] => Array
            (
                [1414531821] => paid
            )
    
        [total] => 75.05
        [currency] =>
        [transaction_id] => 04c4f282-2721-48e2-9ac2-5e001b5974ce
        [parcelas] => 1
    )
    payment info: 1
    1paid: 1

    Is there something wrong at the data I'm saving to database?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.