【发布时间】:2019-11-21 22:20:42
【问题描述】:
我正在尝试使用 php 和 oracle 12c 将我的图像存储到我的数据库中,但它不允许我插入而不给出任何错误
ORDER_ID NOT NULL NUMBER(38)
RX_IMAGE1 NULL BLOB
RX_IMAGE3 NULL BLOB
RX_IMAGE4 NULL BLOB
CREATE_DATE_TIME NULL DATE
LAST_UPDATE_DATE_TIME NULL DATE
RX_IMAGE2 NULL BLOB
public function prc()
{
if ($this->input->post('send_prescription') == 'send_prescription') {
$prescriptionInfo['rx_image1'] = addslashes(file_get_contents($_FILES['pic']['tmp_name']));
$result = $this->PatientModel->setPrescription($prescriptionInfo);
if ($result == TRUE) {
$this->session->set_flashdata('new_val', '1');
} else {
$this->session->set_flashdata('new_val', '0');
}
}
$customer_id = $this->session->userdata('CUSTOMER_ID');
$data['patient_data'] = $this->PatientModel->getPatientsByCustid($customer_id);
$this->load->view('prescription/new_prescription', $data);
}
没有报错
【问题讨论】:
-
最好不要将图像存储在数据库中,数据库应该存储图像的链接。
-
你做得怎么样?发布您正在使用的代码。只有 Oracle SQL/PL/SQL 语句。
-
``` 公共函数 prc(){ if($this->input->post('send_prescription')=='send_prescription'){ $prescriptionInfo['rx_image1'] = addlashes(file_get_contents ($_FILES['pic']['tmp_name'])); $result = $this->PatientModel->setPrescription($prescriptionInfo); if($result==TRUE){ $this->session->set_flashdata('new_val','1'); }else{ $this->session->set_flashdata('new_val','0'); } } $customer_id = $this->session->userdata('CUSTOMER_ID'); $data['patient_data'] = $this->PatientModel->getPatientsByCustid($customer_id); $this->load->view('prescription/new_prescription',$data); } ```
-
请edit问题并在此处添加格式正确的代码。 cmets 中的代码不可读。此外,这似乎是 PHP 代码,如果是这样,
addslashes()是破坏二进制数据的好方法(并且问题被错误标记)。