割引とデビットの値を渡したときに私の計算に少し問題がありますが、割引とデビットの値が何もないときは空白のページが返されます。私のモデルはここにあります。CODEIGNITER。入力テキストが空白の場合にゼロを渡す方法は?
function createInvoice() {
$this->load->helper('date');
$date = date('Y-m-d H:i:s');
$data = array(
'Date' => $date,
'Terms_Of_Payment' => $this->input->post('termsOfPayment'),
'Sub_Total' => $this->input->post('subTotal'),
'Total' => $this->input->post('total') - $this->input->post('discount'),
'Discount' => $this->input->post('discount'),
'Debit' => $this->input->post('debit'),
'Payment_Cridet' => $this->input->post('total') - $this->input->post('debit') - $this->input->post('discount'),
'Note' => $this->input->post('note'),
'Customer_ID' => $this->input->post('customerId'),
'User_ID' => $this->session->userdata('id'));
$this->db->insert('invoice', $data);
return ($this->db->affected_rows() != 1) ? false : true;
}
ありがとうございました。 私を救ってください。 :) –
あなたの答えが受け入れられました。 :) –