2

I'm in a small pickle on this one. I'm using Codeigniter controller.

I need to update an Order status where "DATA HERE" is located in the code below.

Basically here is what i need to do locate the $orderid within a table called "orders" find the "status" and update it to the text "Paid".

$orderid = $id;

if($this->input->post("status")=="OK" && $this->input->post("step")=="Confirmation" && $this->input->post("orderhash")==$orderHashOrg)
    {
        // DATA HERE    
    }

Any help is greatly appreciated.

Here is my current code

$updateData=array("status"=>"Paid");

    if($this->input->post("status")=="OK" && $this->input->post("step")=="Confirmation" && $this->input->post("orderhash")==$orderHashOrg)
    {

        $d = $this->db->get('offers_orders');
        $this->db->select('status');
        $this->db->where('order_number', $id);

        $orderdata = $d->result_array();

        $this->db->update("offers_orders", $updateData);

    }
2
  • write your code first, we can help fix the bug Commented Jun 28, 2013 at 13:56
  • Just updated... Thank you! Commented Jun 28, 2013 at 14:41

2 Answers 2

6

Assuming you have established your database connection.

 $orderid = $id;

if($this->input->post("status")=="OK" && $this->input->post("step")=="Confirmation" && $this->input->post("orderhash")==$orderHashOrg)
{

$updateData=array("status"=>"Paid");

$this->db->where("orderid",$orderid);
$this->db->update("orders",$updateData);    
}
Sign up to request clarification or add additional context in comments.

Comments

-2
function update ($data,$id){

    $this->db->where('user.id',intval($id));

    return $this->db->update('user', $data);

}

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.