this is the sql query i used before i switch to codeigniter
UPDATE transaction SET due_amount = to_pay-$payment_amount WHERE id = '$id'
with codeigniter
$this->db->set('due_amount', 'to_pay-'.$payment_amount, FALSE);
$this->db->where('id', $id);
$result = $this->db->update('transaction');
in the codeigniter code am i writing $this->db->set correctly?
Regards
There are multiple variants to use the
updateDocs function. Yours doesn’t look specifically bad (I would however don’t bypass escaping if not for a specific reason), maybe you prefer to use an array (or object) to provide the data being updated: