I Want To insert data in transaction table and at the same time update customer table in codeigniter
Codeigniter does not support join for update in active records. You need to update your code as follows:

public function add($_iN, $_iC, $desc, $q, $qs, $_up, $_tp, $change_due, 
$cn) {
$data = ['itemName' =&gt; $_iN, 'itemCode' =&gt; $_iC, 'description' =&gt; $desc,
'quantity' =&gt; $q, 'quantitys' =&gt; $qs, 'unitPrice' =&gt; $_up, 
'totalPrice' =&gt; $_tp,'changeDue' =&gt; $change_due,'cust_id'=&gt;$cn];
     $this-&gt;db-&gt;insert('transactions', $data);
     $updateSuccess=$this-&gt;db-&gt;query('customer JOIN transactions ON transactions.cust_id = customer.customer_id SET customer.now_debt = customer.now_debt + ? where customer_id = ? ' , array($change_due,$cn));
    if ($updateSuccess) {
        return $this-&gt;db-&gt;insert_id();
    }
    else {
        log_message('error',$this-&gt;db-&gt;error());
        return FALSE;
    }
}