Use CodeIgniter Active Record to convert MySQL query -
can convert normal mysql query codeigniter update strcuture.
update game_rounds set from_score = case when from_id = 2 65 else from_score end, to_score = case when to_id = 2 65 else to_score end round_id=5
i tried update_batch not able find correct solution.
thanks in advance
$this->db ->set('from_score', 'case when from_id = 2 65 else from_score end', false) ->set('to_score', 'case when to_id = 2 65 else to_score end', false) ->where('round_id', 5) ->update('game_rounds');
$this->db->set() enables set values inserts or updates. can used instead of passing data array directly insert or update functions.
the optional third parameter ($escape), prevent data being escaped if set false.
Comments
Post a Comment