![](/img/trans.png)
[英]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.