简体   繁体   中英

NULL variable value from a input insert in codeigniter

    $imageencode = $this->curl->simple_get($reqUrl);

    $data = array(  
            'image' => $this->input->post('imageencode')
            );
    $this->db->insert('images_from_balance',$data);

In my $imageencode variable I will get a binary code for a image, and I want to insert that in a mysql table called images_from_balance on a blob type field named image.

I think that is a problem with the format of my array, that is from html form inputs, but I don't know how to make that array to insert my variable.

This is my error that I get:

A Database Error Occurred

Error Number: 1048

Column 'image' cannot be null

INSERT INTO images_from_balance ( image ) VALUES (NULL)

Update

$imageencode = $this->curl->simple_get($reqUrl);
$data = array( 'image' => $this->input->post('imageencode'));

With:

$imageencode = $this->curl->simple_get($reqUrl);
$data = array( 'image' => $imageencode);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM