0

I got this error when I update the status of order from 1 to 2.

Message: Array to string conversion

Filename: database/DB_query_builder.php

Here's my Model:

public function confirm_order($status, $cart_id)
{
    $this->db->where('cart_id',$cart_id);
    $this->db->update('cart',$status);
    return $query->result();
}

My Controller:

public function confirm_order($cart_id)
{   
    $status = array
    (
        'status'=>2
    );
    $this->queries_order->confirm_order($cart_id,$status);
    redirect('get_order_details');
}
4
  • which line does generate the error ? Commented Feb 27, 2018 at 7:50
  • 1
    you should print $status and $cart_id and show the result Commented Feb 27, 2018 at 7:50
  • 1
    check your parameters are swapped wrong. status, cart_id => cart_id, status Commented Feb 27, 2018 at 7:50
  • @Dave I posted it as answer. If it solve your problem please accept it :) Commented Feb 27, 2018 at 8:03

1 Answer 1

1

Seems OP have typo in parameter, swapping the position between two solved his problem.

confirm_order($cart_id,$status); should be changed to confirm_order($status, $cart_id);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.