1 回答
TA贡献1898条经验 获得超8个赞
$this->db->set('loan_amount','loan_amount-balance', false);它不会生效,因为您设置$data了$this->db->update('employee',$data);.
这将解决您的问题:)
public function deduct($id){
$data = array(
'loan' => $this->input->post('loan'),
'id' => $id,
'loan_type' => $this->input->post('loan_type'),
'loan_amount' => $this->input->post('loan_amount') - $this->input->post('cash_amount'),
'firstname' => $this->input->post('firstname'),
'lastname' => $this->input->post('lastname'),
'middlename' => $this->input->post('middlename'),
'gender' => $this->input->post('gender'),
'civilstatus' => $this->input->post('civilstatus'),
'birthday' => $this->input->post('birthday'),
'age' => $this->input->post('age'),
'dependents' => $this->input->post('dependents'),
'spousefirstname' => $this->input->post('spousefirstname'),
'spouselastname' => $this->input->post('spouselastname'),
'spousemiddlename' => $this->input->post('spousemiddlename'),
'spouseage' => $this->input->post('spouseage'),
'spousebirthday' => $this->input->post('spousebirthday'),
'homeaddress' => $this->input->post('homeaddress'),
'zipcode' => $this->input->post('zipcode'),
'lengthofstay' => $this->input->post('lengthofstay'),
'hometype' => $this->input->post('hometype'),
'emailaddress' => $this->input->post('emailaddress'),
'homephonenumber' => $this->input->post('homephonenumber'),
'businessphonenumber' => $this->input->post('businessphonenumber'),
'mobilenumber' => $this->input->post('mobilenumber'),
'nameofbusiness' => $this->input->post('nameofbusiness'),
'natureofbusiness' => $this->input->post('natureofbusiness'),
'addressofbusiness' => $this->input->post('addressofbusiness'),
'yearsofbusiness' => $this->input->post('yearsofbusiness'),
'nameofcomaker' => $this->input->post('nameofcomaker'),
'addressofcomaker' => $this->input->post('addressofcomaker'),
'numberofcomaker' => $this->input->post('numberofcomaker'),
'balance' => $this->input->post('cash_amount')
);
$this->db->where('id', $id);
$this->db->update('employee',$data);
}
- 1 回答
- 0 关注
- 114 浏览
添加回答
举报