I'm trying to use the following command to insert:
$sql = "INSERT INTO tabela (campo1, campo2, campo2, campo4)
values(:campo1, :campo2, :campo3,'S')";
$campos = array(
':campo1' => $nome,
':campo2' => $endreco,
':campo3' => $bairro
);
$insert = DB::insert( $sql, $campos );
But you are returning the following message:
Object of class stdClass could not be converted to string (SQL: INSERT INTO table (field1, field2, field2) values (: field1,: field2,: field3)
I do not know, I tried to change insert
through select
and nothing
Can you help me?
[EDIT 1]
public function salvar( Request $request ){
$solicitante = $request->input( 'solicitante' );
$usuario = $request->input( 'usuario' );
$setor = $request->input( 'setor' );
$descricao = $request->input( 'descricao' );
$ramal = $request->input( 'ramal' );
$observacao = $request->input( 'observacao' );
$codigo = $this->proxRegistro();
$sql = "insert into abertura_chamado
(cd_os, dt_pedido, ds_servico, ds_observacao, nm_solicitante,TP_SITUACAO, CD_SETOR,
CD_MULTI_EMPRESA, CD_TIPO_OS, NM_USUARIO, DT_ULTIMA_ATUALIZACAO,
SN_SOL_EXTERNA, CD_OFICINA, SN_ORDEM_SERVICO_PRINCIPAL,
SN_PACIENTE, DT_ENTREGA, TP_PRIORIDADE, SN_RECEBIDA, SN_ETIQUETA_IMPRESSA,
SN_EMAIL_ENVIADO, TP_CLASSIFICACAO, CD_ESPEC, DS_RAMAL, TP_LOCAL
)
values
( ?, SYSDATE, ?, ?, ?, 'S', ?,
1, 30, ? , SYSDATE ,
'S', 14, 'S',
'N', SYSDATE , ?, 'N', 'N',
'N', 'P', 31, ?, 'I')";
$prioridade = 'E';
$campos = array(
$codigo,
$descricao,
$observacao,
$solicitante,
$setor,
$usuario,
$prioridade,
$ramal
);
DB::insert( $sql, $campos );
}
[EDIT2]