我做错了什么?尝试将datetime插入我的数据库,所有字段都有效,而不是日期时间。我曾尝试过,而不是工作。
查看
<fieldset>
<legend>Account Information</legend>
<?php
echo form_open('banks/create_bank');
echo form_input('bank_name', set_value('bank_name', 'Account Name'));
echo form_input('interest', set_value('interest', 'Interest'));
echo form_input('start_amount', set_value('start_amount', 'Starting Balance'));
echo form_input('length', set_value('length', 'Length'));
echo form_dropdown("<type ='date' name='start_date'>") ;
// echo form_input("<type ='date' name='start_date'>") ;
// echo form_checkbox("<type ='date' name='start_date'>") ;
// echo form_fieldset("<type ='date' name='start_date'>") ;
// echo form_multiselect("<type ='date' name='start_date'>") ;
echo form_submit('submit', 'Add Bank ')
?>
</fieldset>
型号
$new_bank_acc_insert_data = array(
'bank_name' => $this->input->post('bank_name'),
'interest' => ($this->input->post('interest') / 100),
'start_amount' => $this->input->post('start_amount'),
'length' => $this->input->post('length'),
'start_date' => $this->input->post('start_date'),
'mem_id' => $this->session->userdata('id')
);
答案 0 :(得分:3)
从
改变$new_bank_acc_insert_data = array(
'bank_name' => $this->input->post('bank_name'),
'interest' => ($this->input->post('interest') / 100),
'start_amount' => $this->input->post('start_amount'),
'length' => $this->input->post('length'),
'start_date' => $this->input->post('start_date'),
'mem_id' => $this->session->userdata('id')
);
到
$new_bank_acc_insert_data = array(
'bank_name' => $this->input->post('bank_name'),
'interest' => ($this->input->post('interest') / 100),
'start_amount' => $this->input->post('start_amount'),
'length' => $this->input->post('length'),
'start_date' => date('Y-m-d H:i:s',strtotime($this->input->post('start_date'))),
'mem_id' => $this->session->userdata('id')
);