更新Codeigniter Controller/MySQL中的表数据

Jac*_*son 2 php mysql codeigniter

我对这个问题很敏感.我正在使用Codeigniter控制器.

我需要更新订单状态,其中"DATA HERE"位于下面的代码中.

基本上我需要做的就是在名为"orders"的表中找到$ orderid找到"status"并将其更新为"付费"文本.

$orderid = $id;

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

任何帮助是极大的赞赏.

这是我目前的代码

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

    }
Run Code Online (Sandbox Code Playgroud)

Abh*_*nan 5

假设您已建立数据库连接.

 $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);    
}
Run Code Online (Sandbox Code Playgroud)