[英]How to update data in laravel 5.8
i have tried to update data of my database, but there is no error this my method我试图更新我的数据库的数据,但我的方法没有错误
public function update_pj_si(request $request)
{
$id = $request->id;
DB::table('tbl_profil_penyedia')
->where('id_profil_penyedia', $id)
->update(array('status' => 1));
return redirect('/verif/pj_si');
}
if i run this method, it run correctly and no error but the database is not updated.如果我运行此方法,它运行正确且没有错误,但数据库未更新。 how can i fix this?我怎样才能解决这个问题?
The $id
variable doesn't contain a value that exists in your table, tbl_profil_penyedia
, for the field id_profil_penyedia
. $id
变量不包含字段id_profil_penyedia
的表tbl_profil_penyedia
中存在的值。 It is as simple as that.它是如此简单。
You are trying to update a profil_penyedia
that doesn't exist.您正在尝试更新不存在的profil_penyedia
。
The update
call returning 0
, means it didn't update any rows, which means your where
condition didn't yield any results to be updated.返回0
的update
调用意味着它没有更新任何行,这意味着您的where
条件没有产生任何要更新的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.