简体   繁体   中英

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 . It is as simple as that.

You are trying to update a profil_penyedia that doesn't exist.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM