[英]How to fix 'SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'X''
[英]LARAVEL : SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value
我正在尝试创建一条路线来更新 mysql 表“orcamento”中的信息,但出现此错误
enter code here SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: '$orcamento->id' (SQL: update `orcamento` set `cliente` = joao, `vendedor` = Carlos, `descricao` = 2 peças de vidro, `valor` = 600, `orcamento`.`updated_at` = 2020-08-15 08:15:40 where (`id` = $orcamento->id))
created_at 和 updated_at 由时间戳构建
enter code here {
Schema::create('orcamento', function (Blueprint $table) {
$table->id();
$table->text('vendedor');
$table->text('cliente');
$table->text('descricao');
$table->double('valor',10,2);
$table->timestamps();
});
}
在路线更新是这样的
public function update(OrcamentoRequest $request, $id)
{
$orcamentos = ModelsOrcamentoModel::where(['id'=>$id])->update([
'cliente'=>$request->cliente,
'vendedor'=>$request->vendedor,
'descricao'=>$request->descricao,
'valor'=>$request->valor
]);
return redirect('cadastros');
}
执行 dd function 我得到了这个
'$orcamentos = ModelsOrcamentoModel::where(['id'=>$id])->dd($id,$request->valor);'
"$orcamento->id" "600"
我在表格中传递了错误的 url
<form action="{{url('orcamentos/'.$orcamento->id)}}" name="formEdit" id="formEdit" method="post">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.