Я написал код для загрузки файла в базу данных MySQL, используя php. Ниже приведен мой код для загрузки файла.Ошибка загрузки файла с помощью php
$data['report_type'] = $this->input->post('report_type');
$data['document_type'] = $this->input->post('document_type');
$data['prescription_id'] = $this->input->post('prescription_id');
$data['description'] = $this->input->post('description');
$data['timestamp'] = strtotime(date('Y-m-d') . ' ' . date('H:i:s'));
$data['laboratorist_id'] = $this->session->userdata('laboratorist_id');
move_uploaded_file($_FILES["userfile"]["tmp_name"], "uploads/diagnosis_report/" . $_FILES["userfile"]["name"]);
$data['file_name'] = $_FILES["userfile"]["name"];
$this->db->insert('diagnosis_report', $data);
$this->session->set_flashdata('flash_message', get_phrase('diagnosis_report_created'));
redirect(base_url() . 'index.php?laboratorist/manage_prescription/edit/' . $this->input->post('prescription_id'), 'refresh');
Всякий раз, когда я пытаюсь загрузить любой файл. Он дает сообщение об ошибке
Column 'file_name' cannot be null
INSERT INTO
diagnosis_report
(report_type
,document_type
,prescription_id
,description
,timestamp
,laboratorist_id
,file_name
) VALUES (0, 0, 0, 0, 1392206996, '1', NULL)
Что не так с моим кодом?
'INSERT INTO diagnosis_report (REPORT_TYPE, document_type, prescription_id, описание , timestamp, labatorist_id, имя_файла) VALUES (0, 0, 0, 0, 1392206996, '1', '') ' –
вы используете frameworkignign framework – Jenz
yes @Jenz! Я использую рамки Codeigniter! – user3116267