dimanche 11 octobre 2020

Laravel 5.2 - SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;

I got this error when i run edit method.

Laravel 5.2 - SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0' at line 1 (SQL: select * from q_alat offset 0)

here is the method of edit in my controller:

public function edit($no1,$no2,$no3,$no4){
    $page = session('alatPage');
    $no_inventaris = $no1."/".$no2."/".$no3."/".$no4;
    $data = DB::table('q_alat')->paginate($page);
    $jenis_alat = Jenis_alat::get();
    $departement = Departement::get();
    $plant = Plant::get();
    $kategori = kategori::get();
    $workcenter = Workcenter::get();
    $kalibrator = Alat::where('kategori','=','standard')->get();
    $edit = DB::table('q_alat')->where('no_inventaris','=',$no_inventaris)->first();
    $get_kode = $edit->kode_lokasi;
    $id_plant = substr($get_kode, 2);
    $id_departement = substr($get_kode, 0,2);
    $edit_plant = Plant::where('id_plant','=',$id_plant)->first();
    $edit_departement = Departement::where('id_departement','=',$id_departement)->first();
    return view('/akun/admin_0/alat/index')
    ->with('jenis_alat',$jenis_alat)
    ->with('q_alat',$data)
    ->with('departement',$departement)
    ->with('plant',$plant)
    ->with('workcenter',$workcenter)
    ->with('kategori',$kategori)
    ->with('kalibrator',$kalibrator)
    ->with('edit_plant',$edit_plant)
    ->with('edit_departement',$edit_departement)
    ->with('edit',$edit)
    ->with('page',$page)
    ->with('sort','1');
}

here is the route:

Route::post('alat/{id1}/{id2}/{id3}/{id4}/edit', 'Crudcontroller@edit')->middleware('admin_petugas');

please help me, thank you



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire