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

Asked

Viewed 690 times

3

I am using Codeigniter and am registering a call in the bank and receive the following message:

inserir a descrição da imagem aqui

 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');

        }
  • To record you should spend $bank instead of $this

  • How ? I wrote this function on the controller

1 answer

1


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

Change:

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

To:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.