$imageencode = $this->curl->simple_get($reqUrl);
$data = array(
'image' => $this->input->post('imageencode')
);
$this->db->insert('images_from_balance',$data);
在我的 $imageencode 变量中,我将获得图像的二进制代码,我想将其插入到名为 image 的 blob 类型字段上名为 images_from_balance 的 mysql 表中。
我认为这是我的数组格式的问题,它来自 html 表单输入,但我不知道如何使该数组插入我的变量。
这是我得到的错误:
A Database Error Occurred
Error Number: 1048
Column 'image' cannot be null
INSERT INTO
images_from_balance
(image
) VALUES (NULL)
最佳答案
更新
$imageencode = $this->curl->simple_get($reqUrl);
$data = array( 'image' => $this->input->post('imageencode'));
与:
$imageencode = $this->curl->simple_get($reqUrl);
$data = array( 'image' => $imageencode);
关于php - 来自 codeigniter 中输入插入的 NULL 变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42224973/