A Database Error Occurred: You must use the "set" method to update an entry

2

I am using Codeigniter and I am registering a call in the database and I get the following message:

 public function solicitacaoRapida(){

            $banco = array(
            'solicitante'   => $this->input->post('empresaSolicitante'),
            'local'     => $this->input->post('localEmpresa'),
            'departamento'  => $this->input->post('nomeDepartamento'),
            'assunto'   => $this->input->post('tipoSolicitacao')
        );

            $this->db->insert('solicitacoes',$this);

            redirect(base_url().'home','refresh');

        }
    
asked by anonymous 01.06.2016 / 21:06

1 answer

1

One of the formats expected by the insert() method is an associative array. In the current code call you pass controller information ( $this ) when expected would be $banco .

Change:

$this->db->insert('solicitacoes', $this);

To:

$this->db->insert('solicitacoes', $banco);
    
01.06.2016 / 21:17