开发者

CodeIgniter active record update how do I do it compared to a SQL query?

Usually when using mysql query, i can do the update like this:

update tb_cash_wallet set close_amount=close_amount+5

If using codeigniter, how can i do this?

example of my code:

$data = array(
        'AMOUNT' => 0.0000,
        'DATEUPDATE' => $datetime,
        'FLAG' => 'Y',
        'CLOSE_AMOUNT' => $val->AMOUNT,         
        );

function close_account($data,$id)
{       
开发者_如何转开发    $this->db->where('ID', $id);        
    return $this->db->update('tb_cash_wallet', $data);  
}


Here:

$this->db->set('close_amount', 'close_amount + 1', FALSE);
$this->db->where('ID'=>$id);
$this->db->update('tb_cash_wallet');

Edit: Incorrect field name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜