3 Updated answer to resolve issue of Protecting identifiers feature
source | link

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' => $_iN, 'itemCode' => $_iC, 'description' => $desc,
'quantity' => $q, 'quantitys' => $qs, 'unitPrice' => $_up, 
'totalPrice' => $_tp,'changeDue' => $change_due,'cust_id'=>$cn];
     $this->db->insert('transactions', $data);
     $this$updateSuccess=$this->db->set>query('customer.now_debt', 'customer.now_debtJOIN +transactions 'ON transactions. $change_due);
  cust_id = customer.customer_id $this->db->where('customer_id',SET $cn);
customer.now_debt = customer.now_debt + ? $this->db->update('customerwhere JOINcustomer_id transactions= ON? transactions.cust_id' =, customer.customer_id'array($change_due,$cn));
    if ($this->db->affected_rows()$updateSuccess) {
        return $this->db->insert_id();
    }
    else {
        log_message('error',$this->db->error());
        return FALSE;
    }
}

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' => $_iN, 'itemCode' => $_iC, 'description' => $desc,
'quantity' => $q, 'quantitys' => $qs, 'unitPrice' => $_up, 
'totalPrice' => $_tp,'changeDue' => $change_due,'cust_id'=>$cn];
     $this->db->insert('transactions', $data);
     $this->db->set('customer.now_debt', 'customer.now_debt + ' . $change_due);
     $this->db->where('customer_id', $cn);
     $this->db->update('customer JOIN transactions ON transactions.cust_id = customer.customer_id');
    if ($this->db->affected_rows()) {
        return $this->db->insert_id();
    }
    else {
        return FALSE;
    }
}

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' => $_iN, 'itemCode' => $_iC, 'description' => $desc,
'quantity' => $q, 'quantitys' => $qs, 'unitPrice' => $_up, 
'totalPrice' => $_tp,'changeDue' => $change_due,'cust_id'=>$cn];
     $this->db->insert('transactions', $data);
     $updateSuccess=$this->db->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->db->insert_id();
    }
    else {
        log_message('error',$this->db->error());
        return FALSE;
    }
}
2 Fixed calculation mistake
source | link

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' => $_iN, 'itemCode' => $_iC, 'description' => $desc,
'quantity' => $q, 'quantitys' => $qs, 'unitPrice' => $_up, 
'totalPrice' => $_tp,'changeDue' => $change_due,'cust_id'=>$cn];
     $this->db->insert('transactions', $data);
     $this->db->set('customer.now_debt', 'customer.now_debt'now_debt + ' . $change_due);
     $this->db->where('customer_id', $cn);
     $this->db->update('customer JOIN transactions ON transactions.cust_id = customer.customer_id');
    if ($this->db->affected_rows()) {
        return $this->db->insert_id();
    }
    else {
        return FALSE;
    }
}

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' => $_iN, 'itemCode' => $_iC, 'description' => $desc,
'quantity' => $q, 'quantitys' => $qs, 'unitPrice' => $_up, 
'totalPrice' => $_tp,'changeDue' => $change_due,'cust_id'=>$cn];
     $this->db->insert('transactions', $data);
     $this->db->set('customer.now_debt', 'customer.now_debt' + $change_due);
     $this->db->where('customer_id', $cn);
     $this->db->update('customer JOIN transactions ON transactions.cust_id = customer.customer_id');
    if ($this->db->affected_rows()) {
        return $this->db->insert_id();
    }
    else {
        return FALSE;
    }
}

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' => $_iN, 'itemCode' => $_iC, 'description' => $desc,
'quantity' => $q, 'quantitys' => $qs, 'unitPrice' => $_up, 
'totalPrice' => $_tp,'changeDue' => $change_due,'cust_id'=>$cn];
     $this->db->insert('transactions', $data);
     $this->db->set('customer.now_debt', 'customer.now_debt + ' . $change_due);
     $this->db->where('customer_id', $cn);
     $this->db->update('customer JOIN transactions ON transactions.cust_id = customer.customer_id');
    if ($this->db->affected_rows()) {
        return $this->db->insert_id();
    }
    else {
        return FALSE;
    }
}
1
source | link

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' => $_iN, 'itemCode' => $_iC, 'description' => $desc,
'quantity' => $q, 'quantitys' => $qs, 'unitPrice' => $_up, 
'totalPrice' => $_tp,'changeDue' => $change_due,'cust_id'=>$cn];
     $this->db->insert('transactions', $data);
     $this->db->set('customer.now_debt', 'customer.now_debt' + $change_due);
     $this->db->where('customer_id', $cn);
     $this->db->update('customer JOIN transactions ON transactions.cust_id = customer.customer_id');
    if ($this->db->affected_rows()) {
        return $this->db->insert_id();
    }
    else {
        return FALSE;
    }
}