Php 更新Codeigniter Controller/MySQL中的表数据

Php 更新Codeigniter Controller/MySQL中的表数据,php,mysql,codeigniter,Php,Mysql,Codeigniter,我在这件事上有点麻烦。我用的是Codeigniter控制器 我需要更新订单状态,其中“数据在此”位于下面的代码中 基本上,我需要做的就是在一个名为“orders”的表中找到$orderid,找到“status”并将其更新为文本“Paid” 非常感谢您的帮助 这是我目前的代码 $updateData=array("status"=>"Paid"); if($this->input->post("status")=="OK" && $this->in

我在这件事上有点麻烦。我用的是Codeigniter控制器

我需要更新订单状态,其中“数据在此”位于下面的代码中

基本上,我需要做的就是在一个名为“orders”的表中找到$orderid,找到“status”并将其更新为文本“Paid”

非常感谢您的帮助

这是我目前的代码

$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);

    }

假设您已经建立了数据库连接

 $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);    
}

首先编写代码,我们可以帮助修复刚刚更新的错误。。。非常感谢。
 $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);    
}
function update ($data,$id){

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

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

}