This is the query that i\'m trying to achieve via active record:
UPDATE `Customer_donations` cd
join Invoices i on i.cd_id = cd.cd_id
set cd.amount = \'4\'
How about the solution below? A bit ugly but it achieved what you expected in your question.
$invoiceId = 13;
$amount = 4;
$data = array('cd.amount'=>$amount, 'cd.amount_verified'=>'1');
$this->db->where('i.invoice_id', $invoiceId);
$this->db->update('Customer_donations cd join Invoices i on i.cd_id = cd.cd_id', $data);
Even cleaner, since update accepts a third "where" array parameter:
$invoiceId = 13;
$amount = 4;
$data = array('cd.amount'=>$amount, 'cd.amount_verified'=>'1');
$this->db->update('Customer_donations cd join Invoices i on i.cd_id = cd.cd_id',
$data, array('i.invoice_id' => $invoiceId));